[
  {
    "path": ".editorconfig",
    "content": "# http://editorconfig.org\nroot = true\n\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[*.{json,php}]\nindent_size = 4\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": ".gitattributes",
    "content": "docs/ export-ignore\nexamples/ export-ignore\ntests/ export-ignore\n.github/ export-ignore\n.editorconfig export-ignore\n.gitattributes export-ignore\n.gitignore export-ignore\n.scrutinizer.yml export-ignore\n\nphpunit.xml.dist export-ignore\nCONTRIBUTING.md export-ignore\nREADME.md export-ignore\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: denis-sokolov\n"
  },
  {
    "path": ".github/workflows/tests.yml",
    "content": "name: Tests\n\non:\n  push:\n  pull_request:\n\njobs:\n  tests:\n    name: PHP ${{ matrix.php }}\n    runs-on: ubuntu-22.04\n\n    strategy:\n      matrix:\n        php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']\n\n    steps:\n      - name: Checkout Code\n        uses: actions/checkout@v6\n\n      - name: Setup PHP\n        uses: shivammathur/setup-php@v2\n        with:\n          php-version: ${{ matrix.php }}\n          tools: composer:v2\n          coverage: none\n        env:\n          update: true\n\n      - name: Setup Problem Matchers\n        run: echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"\n\n      - name: Fix PHPUnit Version PHP < 7.4\n        uses: nick-invision/retry@v3\n        with:\n          timeout_minutes: 5\n          max_attempts: 5\n          command: composer require \"phpunit/phpunit:^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8\" --dev --no-update --no-interaction\n        if: \"matrix.php < 7.4\"\n\n      - name: Fix PHPUnit Version PHP >= 7.4\n        uses: nick-invision/retry@v3\n        with:\n          timeout_minutes: 5\n          max_attempts: 5\n          command: composer require \"phpunit/phpunit:^9.3.3\" --dev --no-update --no-interaction\n        if: \"matrix.php >= 7.4\"\n\n      - name: Install PHP Dependencies\n        uses: nick-invision/retry@v3\n        with:\n          timeout_minutes: 5\n          max_attempts: 5\n          command: composer update --no-interaction --no-progress\n\n      - name: Execute PHPUnit\n        run: vendor/bin/phpunit\n"
  },
  {
    "path": ".gitignore",
    "content": "composer.lock\nphpunit.xml\nreport\nvendor\n"
  },
  {
    "path": ".mailmap",
    "content": "Denis Sokolov <denis@sokolov.cc>\nFilipe Dobreira <dobreira@gmail.com>\n"
  },
  {
    "path": ".scrutinizer.yml",
    "content": "imports:\n  - php\n\nfilter:\n  paths: [src/*]\n\ntools:\n  php_cs_fixer:\n    config: { level: psr1 }\n  php_hhvm: true\n  php_mess_detector: true\n  sensiolabs_security_checker: true\n  external_code_coverage:\n    timeout: '3600'\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# CHANGELOG\n\n## v2.18.0\n\n* Line numbers are now clickable.\n\n## v2.17.0\n\n* Support cursor IDE.\n\n## v2.16.0\n\n* Support PHP `8.4`.\n* Drop support for PHP older than `7.1`.\n\n## v2.15.4\n\n* Improve link color in comments.\n\n## v2.15.3\n\n* Improve performance of the syntax highlighting (#758).\n\n## v2.15.2\n\n* Fixed missing code highlight, which additionally led to issue with switching tabs, between application and all frames ([#747](https://github.com/filp/whoops/issues/747)).\n\n## v2.15.1\n\n* Fixed bug with PrettyPageHandler \"*Calling `getFrameFilters` method on null*\" ([#751](https://github.com/filp/whoops/pull/751)).\n\n## v2.15.0\n\n* Add addFrameFilter ([#749](https://github.com/filp/whoops/pull/749))\n\n## v2.14.6\n\n* Upgraded prismJS to version `1.29.0` due to security issue ([#741][i741]).\n\n[i741]: https://github.com/filp/whoops/pull/741\n\n## v2.14.5\n\n* Allow `ArrayAccess` on super globals.\n\n## v2.14.4\n\n* Fix PHP `5.5` support.\n* Allow to use psr/log `2` or `3`.\n\n## v2.14.3\n\n* Support PHP `8.1`.\n\n## v2.14.1\n\n* Fix syntax highlighting scrolling too far.\n* Improve the way we detect xdebug linkformat.\n\n## v2.14.0\n\n* Switched syntax highlighting to Prism.js.\n\nAvoids licensing issues with prettify, and uses a maintained, modern project.\n\n## v2.13.0\n\n* Add Netbeans editor.\n\n## v2.12.1\n\n* Avoid redirecting away from an error.\n\n## v2.12.0\n\n* Hide non-string values in super globals when requested.\n\n## v2.11.0\n\n* Customize exit code.\n\n## v2.10.0\n\n* Better chaining on handler classes.\n\n## v2.9.2\n\n* Fix copy button styles.\n\n## v2.9.1\n\n* Fix xdebug function crash on PHP `8`.\n\n## v2.9.0\n\n* `JsonResponseHandler` includes the exception code.\n\n## v2.8.0\n\n* Support PHP 8.\n\n## v2.7.3\n\n* `PrettyPageHandler` functionality to hide superglobal keys has a clearer name \n(`hideSuperglobalKey`).\n\n## v2.7.2\n\n* `PrettyPageHandler` now accepts custom js files.\n* `PrettyPageHandler` and `templateHelper` is now accessible through inheritance.\n\n## v2.7.1\n\n* Fix a PHP warning in some cases with anonymous classes.\n\n## v2.7.0\n\n* Added `removeFirstHandler` and `removeLastHandler`.\n\n## v2.6.0\n\n* Fix 2.4.0 `pushHandler` changing the order of handlers.\n\n## v2.5.1\n\n* Fix error messaging in a rare case.\n\n## v2.5.0\n\n* Automatically configure xdebug if available.\n\n## v2.4.1\n\n* Try harder to close all output buffers.\n\n## v2.4.0\n\n* Allow to prepend and append handlers.\n\n## v2.3.2\n\n* Various fixes from the community.\n\n## v2.3.1\n\n* Prevent exception in Whoops when caught exception frame is not related to real file.\n\n## v2.3.0\n\n* Show previous exception messages.\n\n## v2.2.0\n\n* Support PHP `7.2`.\n\n## v2.1.0\n\n* Add a `SystemFacade` to allow clients to override Whoops behavior.\n* Show frame arguments in `PrettyPageHandler`.\n* Highlight the line with the error.\n* Add icons to search on Google and Stack Overflow.\n\n## v2.0.0\n\nBackwards compatibility breaking changes:\n\n* `Run` class is now `final`. If you inherited from `Run`, please now instead use a custom `SystemFacade` injected into the `Run` constructor, or contribute your changes to our core.\n* PHP < 5.5 support dropped.\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "If you want to give me some feedback or make a suggestion, create an [issue on GitHub](https://github.com/filp/whoops/issues/new).\n\nIf you want to get your hands dirty, great! Here's a couple of steps/guidelines:\n- See [a list of possible features to add](https://github.com/filp/whoops/wiki/Possible-features-to-add) for ideas on what can be improved.\n- Add tests for your changes (in `tests/`).\n- Remember to stick to the existing code style as best as possible. When in doubt, follow `PSR-2`.\n- Before investing a lot of time coding, create an issue to get our opinion on your big changes.\n- Update the documentation, if applicable.\n- If you want to add an integration to a web framework, please [review our guidelines for that](docs/Framework%20Integration.md#contributing-an-integration-with-a-framework).\n\nIn `PrettyPageHandler` we are using a Zepto library, but if you are only familiar with jQuery, note that it is pretty much identical.\n"
  },
  {
    "path": "LICENSE.md",
    "content": "# The MIT License\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# whoops\nPHP errors for cool kids\n\n[![Total Downloads](https://img.shields.io/packagist/dm/filp/whoops.svg)](https://packagist.org/packages/filp/whoops)\n[![Latest Version](http://img.shields.io/packagist/v/filp/whoops.svg)](https://packagist.org/packages/filp/whoops)\n[![Build Status on newer versions](https://github.com/filp/whoops/workflows/Tests/badge.svg)](https://github.com/filp/whoops/actions?query=workflow%3ATests)\n[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/filp/whoops/badges/quality-score.png?s=6225c36f2a2dd1fdca11ecc7b10b29105c8c62bd)](https://scrutinizer-ci.com/g/filp/whoops)\n[![Code Coverage](https://scrutinizer-ci.com/g/filp/whoops/badges/coverage.png?s=711feb2069144d252d111b211965ffb19a7d09a8)](https://scrutinizer-ci.com/g/filp/whoops)\n\n-----\n\n![Whoops!](http://i.imgur.com/0VQpe96.png)\n\n**whoops** is an error handler framework for PHP. Out-of-the-box, it provides a pretty\nerror interface that helps you debug your web projects, but at heart it's a simple yet\npowerful stacked error handling system.\n\n## Features\n\n- Flexible, stack-based error handling\n- Stand-alone library with (currently) no required dependencies\n- Simple API for dealing with exceptions, trace frames & their data\n- Includes a pretty rad error page for your webapp projects\n- Includes the ability to [open referenced files directly in your editor and IDE](docs/Open%20Files%20In%20An%20Editor.md)\n- Includes handlers for different response formats (JSON, XML, SOAP)\n- Easy to extend and integrate with existing libraries\n- Clean, well-structured & tested code-base\n\n## Sponsors\n\n<a href=\"https://blackfire.io/docs/introduction?utm_source=whoops&amp;utm_medium=github_readme&amp;utm_campaign=logo\"><img src=\"https://i.imgur.com/zR8rsqk.png\" alt=\"Blackfire.io\" width=\"254\" height=\"64\"></a>\n\n## Installing\nIf you use Laravel 4, Laravel 5.5+ or [Mezzio](https://docs.mezzio.dev/mezzio/), you already have Whoops. There are also community-provided instructions on how to integrate Whoops into\n[Silex 1](https://github.com/whoops-php/silex-1),\n[Silex 2](https://github.com/texthtml/whoops-silex),\n[Phalcon](https://github.com/whoops-php/phalcon),\n[Laravel 3](https://gist.github.com/hugomrdias/5169713#file-start-php),\n[Laravel 5](https://github.com/GrahamCampbell/Laravel-Exceptions),\n[CakePHP 3](https://github.com/dereuromark/cakephp-whoops/tree/cake3),\n[CakePHP 4](https://github.com/dereuromark/cakephp-whoops),\n[Zend 2](https://github.com/ghislainf/zf2-whoops),\n[Zend 3](https://github.com/Ppito/zf3-whoops),\n[Yii 1](https://github.com/igorsantos07/yii-whoops),\n[FuelPHP](https://github.com/indigophp/fuel-whoops),\n[Slim](https://github.com/zeuxisoo/php-slim-whoops/),\n[Pimple](https://github.com/texthtml/whoops-pimple),\n[Laminas](https://github.com/Ppito/laminas-whoops),\nor any framework consuming [StackPHP middlewares](https://github.com/thecodingmachine/whoops-stackphp)\nor [PSR-7 middlewares](https://github.com/franzliedke/whoops-middleware).\n\nIf you are not using any of these frameworks, here's a very simple way to install:\n\n1. Use [Composer](http://getcomposer.org) to install Whoops into your project:\n\n    ```bash\n    composer require filp/whoops\n    ```\n\n1. Register the pretty handler in your code:\n\n    ```php\n    $whoops = new \\Whoops\\Run;\n    $whoops->pushHandler(new \\Whoops\\Handler\\PrettyPageHandler);\n    $whoops->register();\n    ```\n\nFor more options, have a look at the **example files** in [`examples/`](./examples) to get a feel for how things work. Also take a look at the [API Documentation](docs/API%20Documentation.md) and the list of available handlers below.\n\nYou may also want to override some system calls Whoops does. To do that, extend `Whoops\\Util\\SystemFacade`, override functions that you want and pass it as the argument to the `Run` constructor.\n\nYou may also collect the HTML generated to process it yourself:\n\n```php\n$whoops = new \\Whoops\\Run;\n$whoops->allowQuit(false);\n$whoops->writeToOutput(false);\n$whoops->pushHandler(new \\Whoops\\Handler\\PrettyPageHandler);\n$html = $whoops->handleException($e);\n```\n\n### Available Handlers\n\n**whoops** currently ships with the following built-in handlers, available in the `Whoops\\Handler` namespace:\n\n- [`PrettyPageHandler`](https://github.com/filp/whoops/blob/master/src/Whoops/Handler/PrettyPageHandler.php) - Shows a pretty error page when something goes pants-up\n- [`PlainTextHandler`](https://github.com/filp/whoops/blob/master/src/Whoops/Handler/PlainTextHandler.php) - Outputs plain text message for use in CLI applications\n- [`CallbackHandler`](https://github.com/filp/whoops/blob/master/src/Whoops/Handler/CallbackHandler.php) - Wraps a closure or other callable as a handler. You do not need to use this handler explicitly, **whoops** will automatically wrap any closure or callable you pass to `Whoops\\Run::pushHandler`\n- [`JsonResponseHandler`](https://github.com/filp/whoops/blob/master/src/Whoops/Handler/JsonResponseHandler.php) - Captures exceptions and returns information on them as a JSON string. Can be used to, for example, play nice with AJAX requests.\n- [`XmlResponseHandler`](https://github.com/filp/whoops/blob/master/src/Whoops/Handler/XmlResponseHandler.php) - Captures exceptions and returns information on them as a XML string. Can be used to, for example, play nice with AJAX requests.\n\nYou can also use pluggable handlers, such as [SOAP handler](https://github.com/whoops-php/soap).\n\n## Authors\n\nThis library was primarily developed by [Filipe Dobreira](https://github.com/filp), and is currently maintained by [Denis Sokolov](https://github.com/denis-sokolov). A lot of awesome fixes and enhancements were also sent in by [various contributors](https://github.com/filp/whoops/contributors). Special thanks to [Graham Campbell](https://github.com/GrahamCampbell) and [Markus Staab](https://github.com/staabm) for continuous participation.\n"
  },
  {
    "path": "SECURITY.md",
    "content": "# Security Policy\n\n## Supported Versions\n\nOnly the latest released version of Whoops is supported.\nTo facilitate upgrades we almost never make backwards-incompatible changes.\n\n## Reporting a Vulnerability\n\nPlease report vulnerabilities over email, by sending an email to `denis` at `sokolov` dot `cc`.\n\n\n"
  },
  {
    "path": "composer.json",
    "content": "{\n    \"name\": \"filp/whoops\",\n    \"license\": \"MIT\",\n    \"description\": \"php error handling for cool kids\",\n    \"keywords\": [\"library\", \"error\", \"handling\", \"exception\", \"whoops\", \"throwable\"],\n    \"homepage\": \"https://filp.github.io/whoops/\",\n    \"authors\": [\n        {\n            \"name\": \"Filipe Dobreira\",\n            \"homepage\": \"https://github.com/filp\",\n            \"role\": \"Developer\"\n        }\n    ],\n    \"scripts\": {\n        \"demo\": \"php -S localhost:8000 ./examples/example.php\",\n        \"test\": \"phpunit --testdox tests\"\n    },\n    \"require\": {\n        \"php\": \"^7.1 || ^8.0\",\n        \"psr/log\": \"^1.0.1 || ^2.0 || ^3.0\"\n    },\n    \"require-dev\": {\n        \"phpunit/phpunit\": \"^7.5.20 || ^8.5.8 || ^9.3.3 || ^10.5.58\",\n        \"mockery/mockery\": \"^1.0\",\n        \"symfony/var-dumper\": \"^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0\"\n    },\n    \"suggest\": {\n        \"symfony/var-dumper\": \"Pretty print complex values better with var-dumper available\",\n        \"whoops/soap\": \"Formats errors as SOAP responses\"\n    },\n    \"autoload\": {\n        \"psr-4\": {\n            \"Whoops\\\\\": \"src/Whoops/\"\n        }\n    },\n    \"autoload-dev\": {\n        \"psr-4\": {\n            \"Whoops\\\\\": \"tests/Whoops/\"\n        }\n    },\n    \"extra\": {\n        \"branch-alias\": {\n            \"dev-master\": \"2.7-dev\"\n        }\n    }\n}\n"
  },
  {
    "path": "docs/API Documentation.md",
    "content": "# API Documentation\n\n### Core Classes:\n- [`Whoops\\Run`](#whoops-run) - The main `Whoops` class - represents the stack and current execution\n- [`Whoops\\Handler\\Handler` and `Whoops\\Handler\\HandlerInterface`](#handler-abstract) - Abstract representation of a Handler, and utility methods\n- [`Whoops\\Exception\\Inspector`](#inspector) - Exposes methods to inspect an exception\n- [`Whoops\\Exception\\FrameCollection`](#frame-collection) - Exposes methods to work with a list of frames\n- [`Whoops\\Exception\\Frame`](#frame) - Exposes methods to inspect a single stack trace frame from an exception\n\n### Core Handlers:\n- [`Whoops\\Handler\\CallbackHandler`](#handler-callback) - Wraps regular closures as handlers\n- [`Whoops\\Handler\\JsonResponseHandler`](#handler-json) - Formats errors and exceptions as a JSON payload\n- [`Whoops\\Handler\\PrettyPageHandler`](#handler-pretty) - Outputs a detailed, fancy error page\n\n### Core Functions:\n- [`Whoops\\Util\\Misc::isAjaxRequest()`](#fn-ajax) - Determines whether the current request was triggered by XMLHttpRequest\n- [`Whoops\\Util\\Misc::isCommandLine()`](#fn-cli) - Determines whether the current request was triggered via php commandline interface (CLI)\n\n\n# Core Classes:\n\n## <a name=\"whoops-run\"></a> `Whoops\\Run`\n\nThe `Run` class models an instance of an execution, and integrates the methods to control whoops' execution in that context, and control the handlers stack.\n\n### Constants\n\n```php\nstring Run::EXCEPTION_HANDLER // (name for exception handler method)\nstring Run::ERROR_HANDLER     // (name for error handler method)\nstring Run::SHUTDOWN_HANDLER  // (name for shutdown handler method)\n```\n\n### Methods\n\n```php\nRun::prependHandler(Whoops\\HandlerInterface $handler)\n  #=> Whoops\\Run\nRun::appendHandler(Whoops\\HandlerInterface $handler)\n  #=> Whoops\\Run\nRun::removeFirstHandler()\n  #=> null\nRun::removeLastHandler()\n  #=> null\n\n// Returns all handlers in the stack\nRun::getHandlers()\n #=> Whoops\\HandlerInterface[]\n\n// Returns a Whoops\\Inspector instance for a given Exception\nRun::getInspector(Exception $exception)\n #=> Whoops\\Exception\\Inspector\n\n// Registers this Whoops\\Run instance as an error/exception/shutdown\n// handler with PHP\nRun::register()\n #=> Whoops\\Run\n\n// I'll let you guess this one\nRun::unregister()\n #=> Whoops\\Run\n\n// Send a custom exit code in CLI context (default: 1)\nRun::sendExitCode($code = null)\n #=> int\n\n// If true, allows Whoops to terminate script execution (default: true)\nRun::allowQuit($allowQuit = null)\n #=> bool\n\n// Silence errors for paths matching regular expressions and PHP error constants.\n// Can be called multiple times.\nRun::silenceErrorsInPaths($patterns, $levels = E_STRICT | E_DEPRECATED)\n #=> Whoops\\Run\n \n// If true, allows Whoops to send output produced by handlers directly\n// to the client. You'll want to set this to false if you want to\n// package the handlers' response into your HTTP response abstraction\n// or something (default: true)\nRun::writeToOutput($send = null)\n #=> bool\n\n// ** HANDLERS **\n// These are semi-internal methods that receive input from\n// PHP directly. If you know what you're doing, you can\n// also call them directly\n\n// Handles an exception with the current stack. Returns the\n// output produced by handlers.\nRun::handleException(Exception $exception)\n #=> string\n\n// Handles an error with the current stack. Errors are\n// converted into SPL ErrorException instances\nRun::handleError(int $level, string $message, string $file = null, int $line = null)\n #=> null\n\n// Hooked as a shutdown handler, captures fatal errors and handles them\n// through the current stack:\nRun::handleShutdown()\n #=> null\n\n// adds a new frame filter callback to the frame filters stack\nRun::addFrameFilter()\n #=> Whoops\\Run\n```\n\n## <a name=\"handler-abstract\"></a> `Whoops\\Handler\\Handler` & `Whoops\\Handler\\HandlerInterface`\n\nThis abstract class contains the base methods for concrete handler implementations. Custom handlers can extend it, or implement the `Whoops\\Handler\\HandlerInterface` interface.\n\n### Constants\n```php\nint Handler::DONE          // If returned from HandlerInterface::handle, does absolutely nothing.\nint Handler::LAST_HANDLER  // ...tells whoops to not execute any more handlers after this one.\nint Handler::QUIT          // ...tells whoops to quit script execution immediately.\n```\n\n### Methods\n\n```php\n// Custom handlers should expose this method, which will be called once an\n// exception needs to be handled. The Handler::* constants can be used to\n// signal the underlying logic as to what to do next.\nHandlerInterface::handle()\n #=> null | int\n\n// Sets the Run instance for this handler\nHandlerInterface::setRun(Whoops\\Run $run)\n #=> null\n\n// Sets the Inspector instance for this handler\nHandlerInterface::setInspector(Whoops\\Exception\\Inspector $inspector)\n #=> null\n\n// Sets the Exception for this handler to handle\nHandlerInterface::setException(Exception $exception)\n #=> null\n```\n\n## <a name=\"inspector\"></a> `Whoops\\Exception\\Inspector`\n\nThe `Inspector` class provides methods to inspect an exception instance, with particular focus on its frames/stack-trace.\n\n### Methods\n\n```php\nInspector::__construct(Exception $exception)\n #=> null\n\n// Returns the Exception instance being inspected\nInspector::getException()\n #=> Exception\n\n// Returns the string name of the Exception being inspected\n// A faster way of doing get_class($inspector->getException())\nInspector::getExceptionName()\n #=> string\n\n// Returns the string message for the Exception being inspected\n// A faster way of doing $inspector->getException()->getMessage()\nInspector::getExceptionMessage()\n #=> string\n\n// Returns an iterator instance for all the frames in the stack\n// trace for the Exception being inspected.\nInspector::getFrames()\n #=> Whoops\\Exception\\FrameIterator\n```\n\n## <a name=\"frame-collection\"></a> `Whoops\\Exception\\FrameCollection`\n\nThe `FrameCollection` class exposes a fluent interface to manipulate and examine a\ncollection of `Frame` instances.\n\n`FrameCollection` objects are **serializable**.\n\n### Methods\n\n```php\n// Returns the number of frames in the collection\n// May also be called as count($frameCollection)\nFrameCollection::count()\n #=> int\n\n// Filter the Frames in the collection with a callable.\n// The callable must accept a Frame object, and return\n// true to keep it in the collection, or false not to.\nFrameCollection::filter(callable $callable)\n #=> FrameCollection\n\n// See: array_map\n// The callable must accept a Frame object, and return\n// a Frame object, doesn't matter if it's the same or not\n// - will throw an UnexpectedValueException if something\n// else is returned.\nFrameCollection::map(callable $callable)\n #=> FrameCollection\n```\n\n## <a name=\"frame\"></a> `Whoops\\Exception\\Frame`\n\nThe `Frame` class models a single frame in an exception's stack trace. You can use it to retrieve info about things such as frame context, file, line number. Additionally, you have available functionality to add comments to a frame, which is made available to other handlers.\n\n`Frame` objects are **serializable**.\n\n### Methods\n\n```php\n// Returns the file path for the file where this frame occurred.\n// The optional $shortened argument allows you to retrieve a\n// shorter, human-readable file path for display.\nFrame::getFile(bool $shortened = false)\n #=> string | null (Some frames do not have a file path)\n\n// Returns the line number for this frame\nFrame::getLine()\n #=> int | null\n\n// Returns the class name for this frame, if it occurred\n// within a class/instance.\nFrame::getClass()\n #=> string | null\n\n// Returns the function name for this frame, if it occurred\n// within a function/method\nFrame::getFunction()\n #=> string | null\n\n// Returns an array of arguments for this frame. Empty if no\n// arguments were provided.\nFrame::getArgs()\n #=> array\n\n// Returns the full file contents for the file where this frame\n// occurred.\nFrame::getFileContents()\n #=> string | null\n\n// Returns an array of lines for a file, optionally scoped to a\n// given range of line numbers. i.e: Frame::getFileLines(0, 3)\n// returns the first 3 lines after line 0 (1)\nFrame::getFileLines(int $start = 0, int $length = null)\n #=> array | null\n\n// Adds a comment to this Frame instance. Comments are shared\n// with everything that can access the frame instance, obviously,\n// so they can be used for a variety of inter-operability purposes.\n// The context option can be used to improve comment filtering.\n// Additionally, if frames contain URIs, the PrettyPageHandler\n// will automagically convert them to clickable anchor elements.\nFrame::addComment(string $comment, string $context = 'global')\n #=> null\n\n// Returns all comments for this instance optionally filtered by\n// a string context identifier.\nFrame::getComments(string $filter = null)\n #=> array\n```\n\n\n# Core Handlers\n\n## <a name=\"handler-callback\"></a> `Whoops\\Handler\\CallbackHandler`\n\nThe `CallbackHandler` handler wraps regular PHP closures as valid handlers. Useful for quick prototypes or simple handlers. When you pass a closure to `Run::pushHandler`, it's automatically converted to a `CallbackHandler` instance.\n\n```php\n<?php\n\nuse Whoops\\Handler\\Handler;\n\n$run->pushHandler(function($exception, $inspector, $run) {\n    var_dump($exception->getMessage());\n    return Handler::DONE;\n});\n\n$run->popHandler() // #=> Whoops\\Handler\\CallbackHandler\n```\n\n### Methods\n\n```php\n// Accepts any valid callable\n// For example, a closure, a string function name, an array\n// in the format array($class, $method)\nCallbackHandler::__construct($callable)\n #=> null\n\nCallbackHandler::handle()\n #=> int | null\n```\n\n## <a name=\"handler-json\"></a> `Whoops\\Handler\\JsonResponseHandler`\n\nThe `JsonResponseHandler`, upon receiving an exception to handle, simply constructs a `JSON` payload, and outputs it. Methods are available to control the detail of the output, and if it should only execute for AJAX requests - paired with another handler under it, such as the `PrettyPageHandler`, it allows you to have meaningful output for both regular and AJAX requests. Neat!\n\nThe `JSON` body has the following format:\n\n```json\n{\n  \"error\": {\n    \"type\": \"RuntimeException\",\n    \"message\": \"Something broke!\",\n    \"file\": \"/var/project/foo/bar.php\",\n    \"line\": 22,\n\n     # if JsonResponseHandler::addTraceToOutput(true):\n     \"trace\": [\n        { \"file\": \"/var/project/foo/index.php\",\n          \"line\": 157,\n          \"function\": \"handleStuffs\",\n          \"class\": \"MyApplication\\DoerOfThings\",\n          \"args\": [ true, 10, \"yay method arguments\" ] },\n        # ... more frames here ...\n     ]\n  }\n}\n```\n\n### Methods\n\n```php\n\n// Should detailed stack trace output also be added to the\n// JSON payload body?\nJsonResponseHandler::addTraceToOutput(bool $yes = null)\n #=> bool\n\nJsonResponseHandler::handle()\n #=> int | null\n```\n\n## <a name=\"handler-pretty\"></a> `Whoops\\Handler\\PrettyPageHandler`\n\nThe `PrettyPageHandler` generates a fancy, detailed error page which includes code views for all frames in the stack trace, environment details, etc. Super neat. It produces a bundled response string that does not require any further HTTP requests, so it's fit to work on pretty much any environment and framework that speaks back to a browser, without you having to explicitly hook it up to your framework/project's routing mechanisms.\n\n### Methods\n\n```php\n// Adds a key=>value table of arbitrary data, labeled by $label, to\n// the output. Useful where you want to display contextual data along\n// with the error, about your application or project.\nPrettyPageHandler::addDataTable(string $label, array $data)\n #=> null\n\n// Similar to PrettyPageHandler::addDataTable, but accepts a callable\n// that will be called only when rendering an exception. This allows\n// you to gather additional data that may not be available very early\n// in the process.\nPrettyPageHandler::addDataTableCallback(string $label, callable $callback)\n #=> null\n\n// Returns all data tables registered with this handler. Optionally\n// accepts a string label, and will only return the data under that\n// label.\nPrettyPageHandler::getDataTables(string $label = null)\n #=> array | array[]\n\n// Sets the title for the error page\nPrettyPageHandler::setPageTitle(string $title)\n #=> null\n\n// Returns the title for the error page\nPrettyPageHandler::getPageTitle()\n #=> string\n\n// Returns a list of string paths where resources\n// used by this handler are searched for - the template and CSS\n// files.\nPrettyPageHandler::getResourcesPaths()\n #=> array\n\n// Adds a string path to the location of resources for the\n// handler. Useful if you want to roll your own template\n// file (pretty-template.php and pretty-page.css) while\n// still using the logic this handler provides\nPrettyPageHandler::addResourcePath(string $resourcesPath)\n #=> null\n\n// Sets an editor to use to open referenced files, either by\n// a string identifier, or as an arbitrary callable that returns\n// a string or an array that can be used as an href attribute.\n// Available built-in editors can be found here: https://github.com/filp/whoops/blob/master/docs/Open Files In An Editor.md\n\nPrettyPageHandler::setEditor(string $editor)\nPrettyPageHandler::setEditor(function ($file, $line) { return string })\n\n// Additionally you may want that the link acts as an ajax request (e.g. Intellij platform)\nPrettyPageHandler::setEditor(function ($file, $line) {\n        return array(\n            'url' => \"http://localhost:63342/api/file/?file=$file&line=$line\",\n            'ajax' => true\n        );\n    }\n)\n #=> null\n\n// Similar to PrettyPageHandler::setEditor, but allows you\n// to name your custom editor, thus sharing it with the\n// rest of the application. Useful if, for example, you integrate\n// Whoops into your framework or library, and want to share\n// support for extra editors with the end-user.\n//\n// $resolver may be a callable, like with ::setEditor, or a string\n// with placeholders %file and %line.\n// For example:\n// $handler->addEditor('whatevs', 'whatevs://open?file=file://%file&line=%line')\nPrettyPageHandler::addEditor(string $editor, $resolver)\n #=> null\n\n\n\nPrettyPageHandler::handle()\n #=> int | null\n```\n\n\n# Core Functions:\n\n## <a name=\"fn-ajax\"></a> `Whoops\\Util\\Misc::isAjaxRequest()`\n #=> boolean\n\n```php\n// Use a certain handler only in AJAX triggered requests\nif (Whoops\\Util\\Misc::isAjaxRequest()){\n  $run->addHandler($myHandler);\n}\n```\n\n## <a name=\"fn-cli\"></a> `Whoops\\Util\\Misc::isCommandLine()`\n #=> boolean\n\n```php\n// Use a certain handler only in php cli\nif (Whoops\\Util\\Misc::isCommandLine()){\n  $run->addHandler($myHandler);\n}\n```\n\n```php\n/*\nOutput the error message only if using command line.\nelse, output to logger if available.\nAllow to safely add this handler to web pages.\n*/\n$plainTextHandler = new PlainTextHandler();\nif (!Whoops\\isCommandLine()){\n  $plainTextHandler->loggerOnly(true);\n}\n$run->addHandler($myHandler);\n```\n"
  },
  {
    "path": "docs/Framework Integration.md",
    "content": "# Contributing an integration with a framework\n\nLately we're preferring to keep integration libraries out of the Whoops core.\nIf possible, consider managing an official Whoops-SomeFramework integration.\n\nThe procedure is not hard at all.\n\n1. Keep your integration classes and instructions in a repository of your own;\n2. Create a `composer.json` file in your repository with contents similar to the following:\n\n```\n{\n    \"name\": \"username/whoops-someframework\",\n    \"description\": \"Integrates the Whoops library into SomeFramework\",\n    \"require\": {\n        \"filp/whoops\": \"1.*\"\n    }\n}\n```\n\n3. [Register it with Packagist](https://packagist.org/packages/submit).\n\nOnce that is done, please create an issue and we will add a link to it in our README.\n\nSomeFramework users then would write this in their `composer.json`:\n\n```\n    \"require\": {\n        \"username/whoops-someframework\": \"*\"\n    }\n```\n\nThis would also install Whoops and you'd be able to release updates to your package as quickly as you wish them to.\n"
  },
  {
    "path": "docs/Open Files In An Editor.md",
    "content": "# Open Files In An Editor\n\nWhen using the pretty error page feature, whoops comes with the ability to\nopen referenced files directly in your IDE or editor.\nThis feature only works in case your php-source files are locally accessible to the machine on which the editor is installed.\n\n```php\n<?php\n\nuse Whoops\\Handler\\PrettyPageHandler;\n\n$handler = new PrettyPageHandler;\n$handler->setEditor('sublime');\n```\n\nThe following editors are currently supported by default.\n\n- `emacs`    - Emacs\n- `idea`     - IDEA\n- `macvim`   - MacVim\n- `phpstorm` - PhpStorm (on Linux you might need to manually install a [handler](https://github.com/sanduhrs/phpstorm-url-handler))\n- `sublime`  - Sublime Text 2 and possibly 3 (on OS X you might need [a special handler](https://github.com/inopinatus/sublime_url))\n- `textmate` - Textmate\n- `xdebug`   - xdebug (uses [xdebug.file_link_format](http://xdebug.org/docs/all_settings#file_link_format))\n- `vscode`   - VSCode (ref [Opening VS Code with URLs](https://code.visualstudio.com/docs/editor/command-line#_opening-vs-code-with-urls))\n- `atom`     - Atom (ref [Add core URI handlers](https://github.com/atom/atom/pull/15935))\n- `espresso` - Espresso\n- `netbeans` - Netbeans (ref [xdebug.file_link_format](http://xdebug.org/docs/all_settings#file_link_format))\n\nAdding your own editor is simple:\n\n```php\n\n$handler->setEditor(function($file, $line) {\n    return \"whatever://open?file=$file&line=$line\";\n});\n\n```\n\nYou can add [IntelliJ Platform](https://github.com/pinepain/PhpStormOpener#phpstormopener) support like this:\n```php\n\n$handler->setEditor(\n    function ($file, $line) {\n        // if your development server is not local it's good to map remote files to local\n        $translations = array('^' . __DIR__ => '~/Development/PhpStormOpener'); // change to your path\n\n        foreach ($translations as $from => $to) {\n            $file = preg_replace('#' . $from . '#', $to, $file, 1);\n        }\n\n        // IntelliJ platform requires that you send an Ajax request, else the browser will quit the page\n        return array(\n            'url' => \"http://localhost:63342/api/file/?file=$file&line=$line\",\n            'ajax' => true\n        );\n    }\n);\n\n```\n"
  },
  {
    "path": "docs/Replay Errors.md",
    "content": "# Replay Errors\n\nYou can replay Errors that happened in production if you serialize them and store them to later replay in a development Whoops:\n\n```php\n$serialized_exception = serialize(new Exception('Something has happened!'));\n\n$whoops = new \\Whoops\\Run;\n$whoops->pushHandler(new \\Whoops\\Handler\\PrettyPageHandler);\n$whoops->register();\n$whoops->handleException(unserialize($serialized_exception));\n```\n\nhttps://github.com/filp/whoops/issues/623\n"
  },
  {
    "path": "examples/example-ajax-only.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n *\n * Run this example file with the PHP 5.4 web server with:\n *\n * $ cd project_dir\n * $ php -S localhost:8080\n *\n * and access localhost:8080/examples/example-ajax-only.php through your browser\n *\n * Or just run it through apache/nginx/what-have-yous as usual.\n */\n\nnamespace Whoops\\Example;\n\nuse RuntimeException;\nuse Whoops\\Handler\\JsonResponseHandler;\nuse Whoops\\Handler\\PrettyPageHandler;\nuse Whoops\\Run;\n\nrequire __DIR__ . '/../vendor/autoload.php';\n\n$run = new Run();\n\n// We want the error page to be shown by default, if this is a\n// regular request, so that's the first thing to go into the stack:\n$run->pushHandler(new PrettyPageHandler());\n\n// Now, we want a second handler that will run before the error page,\n// and immediately return an error message in JSON format, if something\n// goes awry.\nif (\\Whoops\\Util\\Misc::isAjaxRequest()) {\n    $jsonHandler = new JsonResponseHandler();\n\n    // You can also tell JsonResponseHandler to give you a full stack trace:\n    // $jsonHandler->addTraceToOutput(true);\n\n    // You can also return a result compliant to the json:api spec\n    // re: http://jsonapi.org/examples/#error-objects\n    // tl;dr: error[] becomes errors[[]]\n   $jsonHandler->setJsonApi(true);\n\n    // And push it into the stack:\n    $run->pushHandler($jsonHandler);\n}\n\n// That's it! Register Whoops and throw a dummy exception:\n$run->register();\nthrow new RuntimeException(\"Oh fudge napkins!\");\n"
  },
  {
    "path": "examples/example.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n *\n * Run this example file with the PHP 5.4 web server with:\n *\n * $ cd project_dir\n * $ php -S localhost:8080\n *\n * and access localhost:8080/examples/example.php through your browser\n *\n * Or just run it through apache/nginx/what-have-yous as usual.\n */\n\nnamespace Whoops\\Example;\n\nuse Exception as BaseException;\nuse Whoops\\Handler\\PrettyPageHandler;\nuse Whoops\\Run;\n\nrequire __DIR__ . '/../vendor/autoload.php';\nrequire __DIR__ . '/lib.php';\n\nclass Exception extends BaseException\n{\n}\n\n$run     = new Run();\n$handler = new PrettyPageHandler();\n\n// Add a custom table to the layout:\n$handler->addDataTable('Ice-cream I like', [\n    'Chocolate' => 'yes',\n    'Coffee & chocolate' => 'a lot',\n    'Strawberry & chocolate' => 'it\\'s alright',\n    'Vanilla' => 'ew',\n]);\n\n$handler->setApplicationPaths([__FILE__]);\n\n$handler->addDataTableCallback('Details', function(\\Whoops\\Exception\\Inspector $inspector) {\n    $data = array();\n    $exception = $inspector->getException();\n    if ($exception instanceof SomeSpecificException) {\n        $data['Important exception data'] = $exception->getSomeSpecificData();\n    }\n    $data['Exception class'] = get_class($exception);\n    $data['Exception code'] = $exception->getCode();\n    return $data;\n});\n\n$run->pushHandler($handler);\n\n// Example: tag all frames inside a function with their function name\n$run->pushHandler(function ($exception, $inspector, $run) {\n\n    $inspector->getFrames()->map(function ($frame) {\n\n        if ($function = $frame->getFunction()) {\n            $frame->addComment(\"This frame is within function '$function'\", 'cpt-obvious');\n        }\n\n        return $frame;\n    });\n\n});\n\n$run->register();\n\nfunction fooBar()\n{\n    throw new Exception(\"Something broke!\");\n}\n\nfunction bar()\n{\n    whoops_add_stack_frame(function(){\n        fooBar();\n    });\n}\n\nbar();\n"
  },
  {
    "path": "examples/lib.php",
    "content": "<?php\nfunction whoops_add_stack_frame($callback){\n    $callback();\n}\n"
  },
  {
    "path": "phpunit.xml.dist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<phpunit backupGlobals=\"true\" beStrictAboutTestsThatDoNotTestAnything=\"false\" bootstrap=\"tests/bootstrap.php\" cacheResult=\"false\" colors=\"true\">\n    <testsuites>\n        <testsuite name=\"Whoops Tests Suite\">\n            <directory>tests/Whoops/</directory>\n        </testsuite>\n    </testsuites>\n\n    <filter>\n        <whitelist addUncoveredFilesFromWhitelist=\"true\">\n            <directory suffix=\".php\">src/Whoops/</directory>\n            <exclude>\n                <directory>./docs</directory>\n                <directory>./examples</directory>\n                <directory>./tests</directory>\n                <directory>./vendor</directory>\n            </exclude>\n        </whitelist>\n    </filter>\n</phpunit>\n"
  },
  {
    "path": "src/Whoops/Exception/ErrorException.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Exception;\n\nuse ErrorException as BaseErrorException;\n\n/**\n * Wraps ErrorException; mostly used for typing (at least now)\n * to easily cleanup the stack trace of redundant info.\n */\nclass ErrorException extends BaseErrorException\n{\n}\n"
  },
  {
    "path": "src/Whoops/Exception/Formatter.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Exception;\n\nuse Whoops\\Inspector\\InspectorInterface;\n\nclass Formatter\n{\n    /**\n     * Returns all basic information about the exception in a simple array\n     * for further convertion to other languages\n     * @param  InspectorInterface $inspector\n     * @param  bool               $shouldAddTrace\n     * @param  array<callable>    $frameFilters\n     * @return array\n     */\n    public static function formatExceptionAsDataArray(InspectorInterface $inspector, $shouldAddTrace, array $frameFilters = [])\n    {\n        $exception = $inspector->getException();\n        $response = [\n            'type'    => get_class($exception),\n            'message' => $exception->getMessage(),\n            'code'    => $exception->getCode(),\n            'file'    => $exception->getFile(),\n            'line'    => $exception->getLine(),\n        ];\n\n        if ($shouldAddTrace) {\n            $frames    = $inspector->getFrames($frameFilters);\n            $frameData = [];\n\n            foreach ($frames as $frame) {\n                /** @var Frame $frame */\n                $frameData[] = [\n                    'file'     => $frame->getFile(),\n                    'line'     => $frame->getLine(),\n                    'function' => $frame->getFunction(),\n                    'class'    => $frame->getClass(),\n                    'args'     => $frame->getArgs(),\n                ];\n            }\n\n            $response['trace'] = $frameData;\n        }\n\n        return $response;\n    }\n\n    public static function formatExceptionPlain(InspectorInterface $inspector)\n    {\n        $message = $inspector->getException()->getMessage();\n        $frames = $inspector->getFrames();\n\n        $plain = $inspector->getExceptionName();\n        $plain .= ' thrown with message \"';\n        $plain .= $message;\n        $plain .= '\"'.\"\\n\\n\";\n\n        $plain .= \"Stacktrace:\\n\";\n        foreach ($frames as $i => $frame) {\n            $plain .= \"#\". (count($frames) - $i - 1). \" \";\n            $plain .= $frame->getClass() ?: '';\n            $plain .= $frame->getClass() && $frame->getFunction() ? \":\" : \"\";\n            $plain .= $frame->getFunction() ?: '';\n            $plain .= ' in ';\n            $plain .= ($frame->getFile() ?: '<#unknown>');\n            $plain .= ':';\n            $plain .= (int) $frame->getLine(). \"\\n\";\n        }\n\n        return $plain;\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Exception/Frame.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Exception;\n\nuse InvalidArgumentException;\nuse Serializable;\n\nclass Frame implements Serializable\n{\n    /**\n     * @var array\n     */\n    protected $frame;\n\n    /**\n     * @var string\n     */\n    protected $fileContentsCache;\n\n    /**\n     * @var array[]\n     */\n    protected $comments = [];\n\n    /**\n     * @var bool\n     */\n    protected $application;\n\n    public function __construct(array $frame)\n    {\n        $this->frame = $frame;\n    }\n\n    /**\n     * @param  bool        $shortened\n     * @return string|null\n     */\n    public function getFile($shortened = false)\n    {\n        if (empty($this->frame['file'])) {\n            return null;\n        }\n\n        $file = $this->frame['file'];\n\n        // Check if this frame occurred within an eval().\n        // @todo: This can be made more reliable by checking if we've entered\n        // eval() in a previous trace, but will need some more work on the upper\n        // trace collector(s).\n        if (preg_match('/^(.*)\\((\\d+)\\) : (?:eval\\(\\)\\'d|assert) code$/', $file, $matches)) {\n            $file = $this->frame['file'] = $matches[1];\n            $this->frame['line'] = (int) $matches[2];\n        }\n\n        if ($shortened && is_string($file)) {\n            // Replace the part of the path that all frames have in common, and add 'soft hyphens' for smoother line-breaks.\n            $dirname = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__))))));\n            if ($dirname !== '/') {\n                $file = str_replace($dirname, \"&hellip;\", $file);\n            }\n            $file = str_replace(\"/\", \"/&shy;\", $file);\n        }\n\n        return $file;\n    }\n\n    /**\n     * @return int|null\n     */\n    public function getLine()\n    {\n        return isset($this->frame['line']) ? $this->frame['line'] : null;\n    }\n\n    /**\n     * @return string|null\n     */\n    public function getClass()\n    {\n        return isset($this->frame['class']) ? $this->frame['class'] : null;\n    }\n\n    /**\n     * @return string|null\n     */\n    public function getFunction()\n    {\n        return isset($this->frame['function']) ? $this->frame['function'] : null;\n    }\n\n    /**\n     * @return array\n     */\n    public function getArgs()\n    {\n        return isset($this->frame['args']) ? (array) $this->frame['args'] : [];\n    }\n\n    /**\n     * Returns the full contents of the file for this frame,\n     * if it's known.\n     * @return string|null\n     */\n    public function getFileContents()\n    {\n        if ($this->fileContentsCache === null && $filePath = $this->getFile()) {\n            // Leave the stage early when 'Unknown' or '[internal]' is passed\n            // this would otherwise raise an exception when\n            // open_basedir is enabled.\n            if ($filePath === \"Unknown\" || $filePath === '[internal]') {\n                return null;\n            }\n\n            try {\n                $this->fileContentsCache = file_get_contents($filePath);\n            } catch (ErrorException $exception) {\n                // Internal file paths of PHP extensions cannot be opened\n            }\n        }\n\n        return $this->fileContentsCache;\n    }\n\n    /**\n     * Adds a comment to this frame, that can be received and\n     * used by other handlers. For example, the PrettyPage handler\n     * can attach these comments under the code for each frame.\n     *\n     * An interesting use for this would be, for example, code analysis\n     * & annotations.\n     *\n     * @param string $comment\n     * @param string $context Optional string identifying the origin of the comment\n     */\n    public function addComment($comment, $context = 'global')\n    {\n        $this->comments[] = [\n            'comment' => $comment,\n            'context' => $context,\n        ];\n    }\n\n    /**\n     * Returns all comments for this frame. Optionally allows\n     * a filter to only retrieve comments from a specific\n     * context.\n     *\n     * @param  string  $filter\n     * @return array[]\n     */\n    public function getComments($filter = null)\n    {\n        $comments = $this->comments;\n\n        if ($filter !== null) {\n            $comments = array_filter($comments, function ($c) use ($filter) {\n                return $c['context'] == $filter;\n            });\n        }\n\n        return $comments;\n    }\n\n    /**\n     * Returns the array containing the raw frame data from which\n     * this Frame object was built\n     *\n     * @return array\n     */\n    public function getRawFrame()\n    {\n        return $this->frame;\n    }\n\n    /**\n     * Returns the contents of the file for this frame as an\n     * array of lines, and optionally as a clamped range of lines.\n     *\n     * NOTE: lines are 0-indexed\n     *\n     * @example\n     *     Get all lines for this file\n     *     $frame->getFileLines(); // => array( 0 => '<?php', 1 => '...', ...)\n     * @example\n     *     Get one line for this file, starting at line 10 (zero-indexed, remember!)\n     *     $frame->getFileLines(9, 1); // array( 9 => '...' )\n     *\n     * @throws InvalidArgumentException if $length is less than or equal to 0\n     * @param  int                      $start\n     * @param  int                      $length\n     * @return string[]|null\n     */\n    public function getFileLines($start = 0, $length = null)\n    {\n        if (null !== ($contents = $this->getFileContents())) {\n            $lines = explode(\"\\n\", $contents);\n\n            // Get a subset of lines from $start to $end\n            if ($length !== null) {\n                $start  = (int) $start;\n                $length = (int) $length;\n                if ($start < 0) {\n                    $start = 0;\n                }\n\n                if ($length <= 0) {\n                    throw new InvalidArgumentException(\n                        \"\\$length($length) cannot be lower or equal to 0\"\n                    );\n                }\n\n                $lines = array_slice($lines, $start, $length, true);\n            }\n\n            return $lines;\n        }\n    }\n\n    /**\n     * Implements the Serializable interface, with special\n     * steps to also save the existing comments.\n     *\n     * @see Serializable::serialize\n     * @return string\n     */\n    public function serialize()\n    {\n        $frame = $this->frame;\n        if (!empty($this->comments)) {\n            $frame['_comments'] = $this->comments;\n        }\n\n        return serialize($frame);\n    }\n\n    public function __serialize()\n    {\n        $frame = $this->frame;\n        if (!empty($this->comments)) {\n            $frame['_comments'] = $this->comments;\n        }\n        return $frame;\n    }\n\n    /**\n     * Unserializes the frame data, while also preserving\n     * any existing comment data.\n     *\n     * @see Serializable::unserialize\n     * @param string $serializedFrame\n     */\n    public function unserialize($serializedFrame)\n    {\n        $frame = unserialize($serializedFrame);\n\n        if (!empty($frame['_comments'])) {\n            $this->comments = $frame['_comments'];\n            unset($frame['_comments']);\n        }\n\n        $this->frame = $frame;\n    }\n\n    public function __unserialize($frame)\n    {\n        if (!empty($frame['_comments'])) {\n            $this->comments = $frame['_comments'];\n            unset($frame['_comments']);\n        }\n\n        $this->frame = $frame;\n    }\n\n    /**\n     * Compares Frame against one another\n     * @param  Frame $frame\n     * @return bool\n     */\n    public function equals(Frame $frame)\n    {\n        if (!$this->getFile() || $this->getFile() === 'Unknown' || !$this->getLine()) {\n            return false;\n        }\n        return $frame->getFile() === $this->getFile() && $frame->getLine() === $this->getLine();\n    }\n\n    /**\n     * Returns whether this frame belongs to the application or not.\n     *\n     * @return boolean\n     */\n    public function isApplication()\n    {\n        return $this->application;\n    }\n\n    /**\n     * Mark as an frame belonging to the application.\n     *\n     * @param boolean $application\n     */\n    public function setApplication($application)\n    {\n        $this->application = $application;\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Exception/FrameCollection.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Exception;\n\nuse ArrayAccess;\nuse ArrayIterator;\nuse Countable;\nuse IteratorAggregate;\nuse ReturnTypeWillChange;\nuse Serializable;\nuse UnexpectedValueException;\n\n/**\n * Exposes a fluent interface for dealing with an ordered list\n * of stack-trace frames.\n */\nclass FrameCollection implements ArrayAccess, IteratorAggregate, Serializable, Countable\n{\n    /**\n     * @var array[]\n     */\n    private $frames;\n\n    public function __construct(array $frames)\n    {\n        $this->frames = array_map(function ($frame) {\n            return new Frame($frame);\n        }, $frames);\n    }\n\n    /**\n     * Filters frames using a callable, returns the same FrameCollection\n     *\n     * @param  callable        $callable\n     * @return FrameCollection\n     */\n    public function filter($callable)\n    {\n        $this->frames = array_values(array_filter($this->frames, $callable));\n        return $this;\n    }\n\n    /**\n     * Map the collection of frames\n     *\n     * @param  callable        $callable\n     * @return FrameCollection\n     */\n    public function map($callable)\n    {\n        // Contain the map within a higher-order callable\n        // that enforces type-correctness for the $callable\n        $this->frames = array_map(function ($frame) use ($callable) {\n            $frame = call_user_func($callable, $frame);\n\n            if (!$frame instanceof Frame) {\n                throw new UnexpectedValueException(\n                    \"Callable to \" . __CLASS__ . \"::map must return a Frame object\"\n                );\n            }\n\n            return $frame;\n        }, $this->frames);\n\n        return $this;\n    }\n\n    /**\n     * Returns an array with all frames, does not affect\n     * the internal array.\n     *\n     * @todo   If this gets any more complex than this,\n     *         have getIterator use this method.\n     * @see    FrameCollection::getIterator\n     * @return array\n     */\n    public function getArray()\n    {\n        return $this->frames;\n    }\n\n    /**\n     * @see IteratorAggregate::getIterator\n     * @return ArrayIterator\n     */\n    #[ReturnTypeWillChange]\n    public function getIterator()\n    {\n        return new ArrayIterator($this->frames);\n    }\n\n    /**\n     * @see ArrayAccess::offsetExists\n     * @param int $offset\n     */\n    #[ReturnTypeWillChange]\n    public function offsetExists($offset)\n    {\n        return isset($this->frames[$offset]);\n    }\n\n    /**\n     * @see ArrayAccess::offsetGet\n     * @param int $offset\n     */\n    #[ReturnTypeWillChange]\n    public function offsetGet($offset)\n    {\n        return $this->frames[$offset];\n    }\n\n    /**\n     * @see ArrayAccess::offsetSet\n     * @param int $offset\n     */\n    #[ReturnTypeWillChange]\n    public function offsetSet($offset, $value)\n    {\n        throw new \\Exception(__CLASS__ . ' is read only');\n    }\n\n    /**\n     * @see ArrayAccess::offsetUnset\n     * @param int $offset\n     */\n    #[ReturnTypeWillChange]\n    public function offsetUnset($offset)\n    {\n        throw new \\Exception(__CLASS__ . ' is read only');\n    }\n\n    /**\n     * @see Countable::count\n     * @return int\n     */\n    #[ReturnTypeWillChange]\n    public function count()\n    {\n        return count($this->frames);\n    }\n\n    /**\n     * Count the frames that belongs to the application.\n     *\n     * @return int\n     */\n    public function countIsApplication()\n    {\n        return count(array_filter($this->frames, function (Frame $f) {\n            return $f->isApplication();\n        }));\n    }\n\n    /**\n     * @see Serializable::serialize\n     * @return string\n     */\n    #[ReturnTypeWillChange]\n    public function serialize()\n    {\n        return serialize($this->frames);\n    }\n\n    /**\n     * @see Serializable::unserialize\n     * @param string $serializedFrames\n     */\n    #[ReturnTypeWillChange]\n    public function unserialize($serializedFrames)\n    {\n        $this->frames = unserialize($serializedFrames);\n    }\n\n    public function __serialize()\n    {\n        return $this->frames;\n    }\n\n    public function __unserialize(array $serializedFrames)\n    {\n        $this->frames = $serializedFrames;\n    }\n\n    /**\n     * @param Frame[] $frames Array of Frame instances, usually from $e->getPrevious()\n     */\n    public function prependFrames(array $frames)\n    {\n        $this->frames = array_merge($frames, $this->frames);\n    }\n\n    /**\n     * Gets the innermost part of stack trace that is not the same as that of outer exception\n     *\n     * @param  FrameCollection $parentFrames Outer exception frames to compare tail against\n     * @return Frame[]\n     */\n    public function topDiff(FrameCollection $parentFrames)\n    {\n        $diff = $this->frames;\n\n        $parentFrames = $parentFrames->getArray();\n        $p = count($parentFrames)-1;\n\n        for ($i = count($diff)-1; $i >= 0 && $p >= 0; $i--) {\n            /** @var Frame $tailFrame */\n            $tailFrame = $diff[$i];\n            if ($tailFrame->equals($parentFrames[$p])) {\n                unset($diff[$i]);\n            }\n            $p--;\n        }\n        return $diff;\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Exception/Inspector.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Exception;\n\nuse Whoops\\Inspector\\InspectorFactory;\nuse Whoops\\Inspector\\InspectorInterface;\nuse Whoops\\Util\\Misc;\n\nclass Inspector implements InspectorInterface\n{\n    /**\n     * @var \\Throwable\n     */\n    private $exception;\n\n    /**\n     * @var \\Whoops\\Exception\\FrameCollection\n     */\n    private $frames;\n\n    /**\n     * @var \\Whoops\\Exception\\Inspector\n     */\n    private $previousExceptionInspector;\n\n    /**\n     * @var \\Throwable[]\n     */\n    private $previousExceptions;\n\n    /**\n     * @var \\Whoops\\Inspector\\InspectorFactoryInterface|null\n     */\n    protected $inspectorFactory;\n\n    /**\n     * @param \\Throwable $exception The exception to inspect\n     * @param \\Whoops\\Inspector\\InspectorFactoryInterface $factory\n     */\n    public function __construct($exception, $factory = null)\n    {\n        $this->exception = $exception;\n        $this->inspectorFactory = $factory ?: new InspectorFactory();\n    }\n\n    /**\n     * @return \\Throwable\n     */\n    public function getException()\n    {\n        return $this->exception;\n    }\n\n    /**\n     * @return string\n     */\n    public function getExceptionName()\n    {\n        return get_class($this->exception);\n    }\n\n    /**\n     * @return string\n     */\n    public function getExceptionMessage()\n    {\n        return $this->extractDocrefUrl($this->exception->getMessage())['message'];\n    }\n\n    /**\n     * @return string[]\n     */\n    public function getPreviousExceptionMessages()\n    {\n        return array_map(function ($prev) {\n            /** @var \\Throwable $prev */\n            return $this->extractDocrefUrl($prev->getMessage())['message'];\n        }, $this->getPreviousExceptions());\n    }\n\n    /**\n     * @return int[]\n     */\n    public function getPreviousExceptionCodes()\n    {\n        return array_map(function ($prev) {\n            /** @var \\Throwable $prev */\n            return $prev->getCode();\n        }, $this->getPreviousExceptions());\n    }\n\n    /**\n     * Returns a url to the php-manual related to the underlying error - when available.\n     *\n     * @return string|null\n     */\n    public function getExceptionDocrefUrl()\n    {\n        return $this->extractDocrefUrl($this->exception->getMessage())['url'];\n    }\n\n    private function extractDocrefUrl($message)\n    {\n        $docref = [\n            'message' => $message,\n            'url' => null,\n        ];\n\n        // php embbeds urls to the manual into the Exception message with the following ini-settings defined\n        // http://php.net/manual/en/errorfunc.configuration.php#ini.docref-root\n        if (!ini_get('html_errors') || !ini_get('docref_root')) {\n            return $docref;\n        }\n\n        $pattern = \"/\\[<a href='([^']+)'>(?:[^<]+)<\\/a>\\]/\";\n        if (preg_match($pattern, $message, $matches)) {\n            // -> strip those automatically generated links from the exception message\n            $docref['message'] = preg_replace($pattern, '', $message, 1);\n            $docref['url'] = $matches[1];\n        }\n\n        return $docref;\n    }\n\n    /**\n     * Does the wrapped Exception has a previous Exception?\n     * @return bool\n     */\n    public function hasPreviousException()\n    {\n        return $this->previousExceptionInspector || $this->exception->getPrevious();\n    }\n\n    /**\n     * Returns an Inspector for a previous Exception, if any.\n     * @todo   Clean this up a bit, cache stuff a bit better.\n     * @return Inspector\n     */\n    public function getPreviousExceptionInspector()\n    {\n        if ($this->previousExceptionInspector === null) {\n            $previousException = $this->exception->getPrevious();\n\n            if ($previousException) {\n                $this->previousExceptionInspector = $this->inspectorFactory->create($previousException);\n            }\n        }\n\n        return $this->previousExceptionInspector;\n    }\n\n\n    /**\n     * Returns an array of all previous exceptions for this inspector's exception\n     * @return \\Throwable[]\n     */\n    public function getPreviousExceptions()\n    {\n        if ($this->previousExceptions === null) {\n            $this->previousExceptions = [];\n\n            $prev = $this->exception->getPrevious();\n            while ($prev !== null) {\n                $this->previousExceptions[] = $prev;\n                $prev = $prev->getPrevious();\n            }\n        }\n\n        return $this->previousExceptions;\n    }\n\n    /**\n     * Returns an iterator for the inspected exception's\n     * frames.\n     * \n     * @param array<callable> $frameFilters\n     * \n     * @return \\Whoops\\Exception\\FrameCollection\n     */\n    public function getFrames(array $frameFilters = [])\n    {\n        if ($this->frames === null) {\n            $frames = $this->getTrace($this->exception);\n\n            // Fill empty line/file info for call_user_func_array usages (PHP Bug #44428)\n            foreach ($frames as $k => $frame) {\n                if (empty($frame['file'])) {\n                    // Default values when file and line are missing\n                    $file = '[internal]';\n                    $line = 0;\n\n                    $next_frame = !empty($frames[$k + 1]) ? $frames[$k + 1] : [];\n\n                    if ($this->isValidNextFrame($next_frame)) {\n                        $file = $next_frame['file'];\n                        $line = $next_frame['line'];\n                    }\n\n                    $frames[$k]['file'] = $file;\n                    $frames[$k]['line'] = $line;\n                }\n            }\n\n            // Find latest non-error handling frame index ($i) used to remove error handling frames\n            $i = 0;\n            foreach ($frames as $k => $frame) {\n                if ($frame['file'] == $this->exception->getFile() && $frame['line'] == $this->exception->getLine()) {\n                    $i = $k;\n                }\n            }\n\n            // Remove error handling frames\n            if ($i > 0) {\n                array_splice($frames, 0, $i);\n            }\n\n            $firstFrame = $this->getFrameFromException($this->exception);\n            array_unshift($frames, $firstFrame);\n\n            $this->frames = new FrameCollection($frames);\n\n            if ($previousInspector = $this->getPreviousExceptionInspector()) {\n                // Keep outer frame on top of the inner one\n                $outerFrames = $this->frames;\n                $newFrames = clone $previousInspector->getFrames();\n                // I assume it will always be set, but let's be safe\n                if (isset($newFrames[0])) {\n                    $newFrames[0]->addComment(\n                        $previousInspector->getExceptionMessage(),\n                        'Exception message:'\n                    );\n                }\n                $newFrames->prependFrames($outerFrames->topDiff($newFrames));\n                $this->frames = $newFrames;\n            }\n\n            // Apply frame filters callbacks on the frames stack\n            if (!empty($frameFilters)) {\n                foreach ($frameFilters as $filterCallback) {\n                    $this->frames->filter($filterCallback);\n                }\n            }\n        }\n\n        return $this->frames;\n    }\n\n    /**\n     * Gets the backtrace from an exception.\n     *\n     * If xdebug is installed\n     *\n     * @param \\Throwable $e\n     * @return array\n     */\n    protected function getTrace($e)\n    {\n        $traces = $e->getTrace();\n\n        // Get trace from xdebug if enabled, failure exceptions only trace to the shutdown handler by default\n        if (!$e instanceof \\ErrorException) {\n            return $traces;\n        }\n\n        if (!Misc::isLevelFatal($e->getSeverity())) {\n            return $traces;\n        }\n\n        if (!extension_loaded('xdebug') || !function_exists('xdebug_is_enabled') || !xdebug_is_enabled()) {\n            return $traces;\n        }\n\n        // Use xdebug to get the full stack trace and remove the shutdown handler stack trace\n        $stack = array_reverse(xdebug_get_function_stack());\n        $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);\n        $traces = array_diff_key($stack, $trace);\n\n        return $traces;\n    }\n\n    /**\n     * Given an exception, generates an array in the format\n     * generated by Exception::getTrace()\n     * @param  \\Throwable $exception\n     * @return array\n     */\n    protected function getFrameFromException($exception)\n    {\n        return [\n            'file'  => $exception->getFile(),\n            'line'  => $exception->getLine(),\n            'class' => get_class($exception),\n            'args'  => [\n                $exception->getMessage(),\n            ],\n        ];\n    }\n\n    /**\n     * Given an error, generates an array in the format\n     * generated by ErrorException\n     * @param  ErrorException $exception\n     * @return array\n     */\n    protected function getFrameFromError(ErrorException $exception)\n    {\n        return [\n            'file'  => $exception->getFile(),\n            'line'  => $exception->getLine(),\n            'class' => null,\n            'args'  => [],\n        ];\n    }\n\n    /**\n     * Determine if the frame can be used to fill in previous frame's missing info\n     * happens for call_user_func and call_user_func_array usages (PHP Bug #44428)\n     *\n     * @return bool\n     */\n    protected function isValidNextFrame(array $frame)\n    {\n        if (empty($frame['file'])) {\n            return false;\n        }\n\n        if (empty($frame['line'])) {\n            return false;\n        }\n\n        if (empty($frame['function']) || !stristr($frame['function'], 'call_user_func')) {\n            return false;\n        }\n\n        return true;\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Handler/CallbackHandler.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Handler;\n\nuse InvalidArgumentException;\n\n/**\n * Wrapper for Closures passed as handlers. Can be used\n * directly, or will be instantiated automagically by Whoops\\Run\n * if passed to Run::pushHandler\n */\nclass CallbackHandler extends Handler\n{\n    /**\n     * @var callable\n     */\n    protected $callable;\n\n    /**\n     * @throws InvalidArgumentException If argument is not callable\n     * @param  callable                 $callable\n     */\n    public function __construct($callable)\n    {\n        if (!is_callable($callable)) {\n            throw new InvalidArgumentException(\n                'Argument to ' . __METHOD__ . ' must be valid callable'\n            );\n        }\n\n        $this->callable = $callable;\n    }\n\n    /**\n     * @return int|null\n     */\n    public function handle()\n    {\n        $exception = $this->getException();\n        $inspector = $this->getInspector();\n        $run       = $this->getRun();\n        $callable  = $this->callable;\n\n        // invoke the callable directly, to get simpler stacktraces (in comparison to call_user_func).\n        // this assumes that $callable is a properly typed php-callable, which we check in __construct().\n        return $callable($exception, $inspector, $run);\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Handler/Handler.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Handler;\n\nuse Whoops\\Inspector\\InspectorInterface;\nuse Whoops\\RunInterface;\n\n/**\n * Abstract implementation of a Handler.\n */\nabstract class Handler implements HandlerInterface\n{\n    /*\n     Return constants that can be returned from Handler::handle\n     to message the handler walker.\n     */\n    const DONE         = 0x10; // returning this is optional, only exists for\n                               // semantic purposes\n    /**\n     * The Handler has handled the Throwable in some way, and wishes to skip any other Handler.\n     * Execution will continue.\n     */\n    const LAST_HANDLER = 0x20;\n    /**\n     * The Handler has handled the Throwable in some way, and wishes to quit/stop execution\n     */\n    const QUIT         = 0x30;\n\n    /**\n     * @var RunInterface\n     */\n    private $run;\n\n    /**\n     * @var InspectorInterface $inspector\n     */\n    private $inspector;\n\n    /**\n     * @var \\Throwable $exception\n     */\n    private $exception;\n\n    /**\n     * @param RunInterface $run\n     */\n    public function setRun(RunInterface $run)\n    {\n        $this->run = $run;\n    }\n\n    /**\n     * @return RunInterface\n     */\n    protected function getRun()\n    {\n        return $this->run;\n    }\n\n    /**\n     * @param InspectorInterface $inspector\n     */\n    public function setInspector(InspectorInterface $inspector)\n    {\n        $this->inspector = $inspector;\n    }\n\n    /**\n     * @return InspectorInterface\n     */\n    protected function getInspector()\n    {\n        return $this->inspector;\n    }\n\n    /**\n     * @param \\Throwable $exception\n     */\n    public function setException($exception)\n    {\n        $this->exception = $exception;\n    }\n\n    /**\n     * @return \\Throwable\n     */\n    protected function getException()\n    {\n        return $this->exception;\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Handler/HandlerInterface.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Handler;\n\nuse Whoops\\Inspector\\InspectorInterface;\nuse Whoops\\RunInterface;\n\ninterface HandlerInterface\n{\n    /**\n     * @return int|null A handler may return nothing, or a Handler::HANDLE_* constant\n     */\n    public function handle();\n\n    /**\n     * @param  RunInterface  $run\n     * @return void\n     */\n    public function setRun(RunInterface $run);\n\n    /**\n     * @param  \\Throwable $exception\n     * @return void\n     */\n    public function setException($exception);\n\n    /**\n     * @param  InspectorInterface $inspector\n     * @return void\n     */\n    public function setInspector(InspectorInterface $inspector);\n}\n"
  },
  {
    "path": "src/Whoops/Handler/JsonResponseHandler.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Handler;\n\nuse Whoops\\Exception\\Formatter;\n\n/**\n * Catches an exception and converts it to a JSON\n * response. Additionally can also return exception\n * frames for consumption by an API.\n */\nclass JsonResponseHandler extends Handler\n{\n    /**\n     * @var bool\n     */\n    private $returnFrames = false;\n\n    /**\n     * @var bool\n     */\n    private $jsonApi = false;\n\n    /**\n     * Returns errors[[]] instead of error[] to be in compliance with the json:api spec\n     * @param bool $jsonApi Default is false\n     * @return static\n     */\n    public function setJsonApi($jsonApi = false)\n    {\n        $this->jsonApi = (bool) $jsonApi;\n        return $this;\n    }\n\n    /**\n     * @param  bool|null  $returnFrames\n     * @return bool|static\n     */\n    public function addTraceToOutput($returnFrames = null)\n    {\n        if (func_num_args() == 0) {\n            return $this->returnFrames;\n        }\n\n        $this->returnFrames = (bool) $returnFrames;\n        return $this;\n    }\n\n    /**\n     * @return int\n     */\n    public function handle()\n    {\n        if ($this->jsonApi === true) {\n            $response = [\n                'errors' => [\n                    Formatter::formatExceptionAsDataArray(\n                        $this->getInspector(),\n                        $this->addTraceToOutput(),\n                        $this->getRun()->getFrameFilters()\n                    ),\n                ]\n            ];\n        } else {\n            $response = [\n                'error' => Formatter::formatExceptionAsDataArray(\n                    $this->getInspector(),\n                    $this->addTraceToOutput(),\n                    $this->getRun()->getFrameFilters()\n                ),\n            ];\n        }\n\n        echo json_encode($response, defined('JSON_PARTIAL_OUTPUT_ON_ERROR') ? JSON_PARTIAL_OUTPUT_ON_ERROR : 0);\n\n        return Handler::QUIT;\n    }\n\n    /**\n     * @return string\n     */\n    public function contentType()\n    {\n        return 'application/json';\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Handler/PlainTextHandler.php",
    "content": "<?php\n/**\n* Whoops - php errors for cool kids\n* @author Filipe Dobreira <http://github.com/filp>\n* Plaintext handler for command line and logs.\n* @author Pierre-Yves Landuré <https://howto.biapy.com/>\n*/\n\nnamespace Whoops\\Handler;\n\nuse InvalidArgumentException;\nuse Psr\\Log\\LoggerInterface;\nuse Whoops\\Exception\\Frame;\n\n/**\n* Handler outputing plaintext error messages. Can be used\n* directly, or will be instantiated automagically by Whoops\\Run\n* if passed to Run::pushHandler\n*/\nclass PlainTextHandler extends Handler\n{\n    const VAR_DUMP_PREFIX = '   | ';\n\n    /**\n     * @var \\Psr\\Log\\LoggerInterface\n     */\n    protected $logger;\n\n    /**\n     * @var callable\n     */\n    protected $dumper;\n\n    /**\n     * @var bool\n     */\n    private $addTraceToOutput = true;\n\n    /**\n     * @var bool|integer\n     */\n    private $addTraceFunctionArgsToOutput = false;\n\n    /**\n     * @var integer\n     */\n    private $traceFunctionArgsOutputLimit = 1024;\n\n    /**\n     * @var bool\n     */\n    private $addPreviousToOutput = true;\n\n    /**\n     * @var bool\n     */\n    private $loggerOnly = false;\n\n    /**\n     * Constructor.\n     * @throws InvalidArgumentException     If argument is not null or a LoggerInterface\n     * @param  \\Psr\\Log\\LoggerInterface|null $logger\n     */\n    public function __construct($logger = null)\n    {\n        $this->setLogger($logger);\n    }\n\n    /**\n     * Set the output logger interface.\n     * @throws InvalidArgumentException     If argument is not null or a LoggerInterface\n     * @param  \\Psr\\Log\\LoggerInterface|null $logger\n     */\n    public function setLogger($logger = null)\n    {\n        if (! (is_null($logger)\n            || $logger instanceof LoggerInterface)) {\n            throw new InvalidArgumentException(\n                'Argument to ' . __METHOD__ .\n                \" must be a valid Logger Interface (aka. Monolog), \" .\n                get_class($logger) . ' given.'\n            );\n        }\n\n        $this->logger = $logger;\n    }\n\n    /**\n     * @return \\Psr\\Log\\LoggerInterface|null\n     */\n    public function getLogger()\n    {\n        return $this->logger;\n    }\n\n    /**\n     * Set var dumper callback function.\n     *\n     * @param  callable $dumper\n     * @return static\n     */\n    public function setDumper(callable $dumper)\n    {\n        $this->dumper = $dumper;\n        return $this;\n    }\n\n    /**\n     * Add error trace to output.\n     * @param  bool|null  $addTraceToOutput\n     * @return bool|static\n     */\n    public function addTraceToOutput($addTraceToOutput = null)\n    {\n        if (func_num_args() == 0) {\n            return $this->addTraceToOutput;\n        }\n\n        $this->addTraceToOutput = (bool) $addTraceToOutput;\n        return $this;\n    }\n\n    /**\n     * Add previous exceptions to output.\n     * @param  bool|null $addPreviousToOutput\n     * @return bool|static\n     */\n    public function addPreviousToOutput($addPreviousToOutput = null)\n    {\n        if (func_num_args() == 0) {\n            return $this->addPreviousToOutput;\n        }\n\n        $this->addPreviousToOutput = (bool) $addPreviousToOutput;\n        return $this;\n    }\n\n    /**\n     * Add error trace function arguments to output.\n     * Set to True for all frame args, or integer for the n first frame args.\n     * @param  bool|integer|null $addTraceFunctionArgsToOutput\n     * @return static|bool|integer\n     */\n    public function addTraceFunctionArgsToOutput($addTraceFunctionArgsToOutput = null)\n    {\n        if (func_num_args() == 0) {\n            return $this->addTraceFunctionArgsToOutput;\n        }\n\n        if (! is_integer($addTraceFunctionArgsToOutput)) {\n            $this->addTraceFunctionArgsToOutput = (bool) $addTraceFunctionArgsToOutput;\n        } else {\n            $this->addTraceFunctionArgsToOutput = $addTraceFunctionArgsToOutput;\n        }\n        return $this;\n    }\n\n    /**\n     * Set the size limit in bytes of frame arguments var_dump output.\n     * If the limit is reached, the var_dump output is discarded.\n     * Prevent memory limit errors.\n     * @param int $traceFunctionArgsOutputLimit\n     * @return static\n     */\n    public function setTraceFunctionArgsOutputLimit($traceFunctionArgsOutputLimit)\n    {\n        $this->traceFunctionArgsOutputLimit = (int) $traceFunctionArgsOutputLimit;\n        return $this;\n    }\n\n    /**\n     * Create plain text response and return it as a string\n     * @return string\n     */\n    public function generateResponse()\n    {\n        $exception = $this->getException();\n        $message = $this->getExceptionOutput($exception);\n\n        if ($this->addPreviousToOutput) {\n            $previous = $exception->getPrevious();\n            while ($previous) {\n                $message .= \"\\n\\nCaused by\\n\" . $this->getExceptionOutput($previous);\n                $previous = $previous->getPrevious();\n            }\n        }\n\n\n        return $message . $this->getTraceOutput() . \"\\n\";\n    }\n\n    /**\n     * Get the size limit in bytes of frame arguments var_dump output.\n     * If the limit is reached, the var_dump output is discarded.\n     * Prevent memory limit errors.\n     * @return integer\n     */\n    public function getTraceFunctionArgsOutputLimit()\n    {\n        return $this->traceFunctionArgsOutputLimit;\n    }\n\n    /**\n     * Only output to logger.\n     * @param  bool|null $loggerOnly\n     * @return static|bool\n     */\n    public function loggerOnly($loggerOnly = null)\n    {\n        if (func_num_args() == 0) {\n            return $this->loggerOnly;\n        }\n\n        $this->loggerOnly = (bool) $loggerOnly;\n        return $this;\n    }\n\n    /**\n     * Test if handler can output to stdout.\n     * @return bool\n     */\n    private function canOutput()\n    {\n        return !$this->loggerOnly();\n    }\n\n    /**\n     * Get the frame args var_dump.\n     * @param  \\Whoops\\Exception\\Frame $frame [description]\n     * @param  integer                 $line  [description]\n     * @return string\n     */\n    private function getFrameArgsOutput(Frame $frame, $line)\n    {\n        if ($this->addTraceFunctionArgsToOutput() === false\n            || $this->addTraceFunctionArgsToOutput() < $line) {\n            return '';\n        }\n\n        // Dump the arguments:\n        ob_start();\n        $this->dump($frame->getArgs());\n        if (ob_get_length() > $this->getTraceFunctionArgsOutputLimit()) {\n            // The argument var_dump is to big.\n            // Discarded to limit memory usage.\n            ob_clean();\n            return sprintf(\n                \"\\n%sArguments dump length greater than %d Bytes. Discarded.\",\n                self::VAR_DUMP_PREFIX,\n                $this->getTraceFunctionArgsOutputLimit()\n            );\n        }\n\n        return sprintf(\n            \"\\n%s\",\n            preg_replace('/^/m', self::VAR_DUMP_PREFIX, ob_get_clean())\n        );\n    }\n\n    /**\n     * Dump variable.\n     *\n     * @param mixed $var\n     * @return void\n     */\n    protected function dump($var)\n    {\n        if ($this->dumper) {\n            call_user_func($this->dumper, $var);\n        } else {\n            var_dump($var);\n        }\n    }\n\n    /**\n     * Get the exception trace as plain text.\n     * @return string\n     */\n    private function getTraceOutput()\n    {\n        if (! $this->addTraceToOutput()) {\n            return '';\n        }\n        $inspector = $this->getInspector();\n        $frames = $inspector->getFrames($this->getRun()->getFrameFilters());\n\n        $response = \"\\nStack trace:\";\n\n        $line = 1;\n        foreach ($frames as $frame) {\n            /** @var Frame $frame */\n            $class = $frame->getClass();\n\n            $template = \"\\n%3d. %s->%s() %s:%d%s\";\n            if (! $class) {\n                // Remove method arrow (->) from output.\n                $template = \"\\n%3d. %s%s() %s:%d%s\";\n            }\n\n            $response .= sprintf(\n                $template,\n                $line,\n                $class,\n                $frame->getFunction(),\n                $frame->getFile(),\n                $frame->getLine(),\n                $this->getFrameArgsOutput($frame, $line)\n            );\n\n            $line++;\n        }\n\n        return $response;\n    }\n\n    /**\n     * Get the exception as plain text.\n     * @param \\Throwable $exception\n     * @return string\n     */\n    private function getExceptionOutput($exception)\n    {\n        return sprintf(\n            \"%s: %s in file %s on line %d\",\n            get_class($exception),\n            $exception->getMessage(),\n            $exception->getFile(),\n            $exception->getLine()\n        );\n    }\n\n    /**\n     * @return int\n     */\n    public function handle()\n    {\n        $response = $this->generateResponse();\n\n        if ($this->getLogger()) {\n            $this->getLogger()->error($response);\n        }\n\n        if (! $this->canOutput()) {\n            return Handler::DONE;\n        }\n\n        echo $response;\n\n        return Handler::QUIT;\n    }\n\n    /**\n     * @return string\n     */\n    public function contentType()\n    {\n        return 'text/plain';\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Handler/PrettyPageHandler.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Handler;\n\nuse InvalidArgumentException;\nuse RuntimeException;\nuse Symfony\\Component\\VarDumper\\Cloner\\AbstractCloner;\nuse Symfony\\Component\\VarDumper\\Cloner\\VarCloner;\nuse UnexpectedValueException;\nuse Whoops\\Exception\\Formatter;\nuse Whoops\\Util\\Misc;\nuse Whoops\\Util\\TemplateHelper;\n\nclass PrettyPageHandler extends Handler\n{\n    const EDITOR_SUBLIME = \"sublime\";\n    const EDITOR_TEXTMATE = \"textmate\";\n    const EDITOR_EMACS = \"emacs\";\n    const EDITOR_MACVIM = \"macvim\";\n    const EDITOR_PHPSTORM = \"phpstorm\";\n    const EDITOR_IDEA = \"idea\";\n    const EDITOR_VSCODE = \"vscode\";\n    const EDITOR_ATOM = \"atom\";\n    const EDITOR_ESPRESSO = \"espresso\";\n    const EDITOR_XDEBUG = \"xdebug\";\n    const EDITOR_NETBEANS = \"netbeans\";\n    const EDITOR_CURSOR = \"cursor\";\n\n    /**\n     * Search paths to be scanned for resources.\n     *\n     * Stored in the reverse order they're declared.\n     *\n     * @var array\n     */\n    private $searchPaths = [];\n\n    /**\n     * Fast lookup cache for known resource locations.\n     *\n     * @var array\n     */\n    private $resourceCache = [];\n\n    /**\n     * The name of the custom css file.\n     *\n     * @var string|null\n     */\n    private $customCss = null;\n\n    /**\n     * The name of the custom js file.\n     *\n     * @var string|null\n     */\n    private $customJs = null;\n\n    /**\n     * @var array[]\n     */\n    private $extraTables = [];\n\n    /**\n     * @var bool\n     */\n    private $handleUnconditionally = false;\n\n    /**\n     * @var string\n     */\n    private $pageTitle = \"Whoops! There was an error.\";\n\n    /**\n     * @var array[]\n     */\n    private $applicationPaths;\n\n    /**\n     * @var array[]\n     */\n    private $blacklist = [\n        '_GET' => [],\n        '_POST' => [],\n        '_FILES' => [],\n        '_COOKIE' => [],\n        '_SESSION' => [],\n        '_SERVER' => [],\n        '_ENV' => [],\n    ];\n\n    /**\n     * An identifier for a known IDE/text editor.\n     *\n     * Either a string, or a calalble that resolves a string, that can be used\n     * to open a given file in an editor. If the string contains the special\n     * substrings %file or %line, they will be replaced with the correct data.\n     *\n     * @example\n     *   \"txmt://open?url=%file&line=%line\"\n     *\n     * @var callable|string $editor\n     */\n    protected $editor;\n\n    /**\n     * A list of known editor strings.\n     *\n     * @var array\n     */\n    protected $editors = [\n        \"sublime\"  => \"subl://open?url=file://%file&line=%line\",\n        \"textmate\" => \"txmt://open?url=file://%file&line=%line\",\n        \"emacs\"    => \"emacs://open?url=file://%file&line=%line\",\n        \"macvim\"   => \"mvim://open/?url=file://%file&line=%line\",\n        \"phpstorm\" => \"phpstorm://open?file=%file&line=%line\",\n        \"idea\"     => \"idea://open?file=%file&line=%line\",\n        \"vscode\"   => \"vscode://file/%file:%line\",\n        \"atom\"     => \"atom://core/open/file?filename=%file&line=%line\",\n        \"espresso\" => \"x-espresso://open?filepath=%file&lines=%line\",\n        \"netbeans\" => \"netbeans://open/?f=%file:%line\",\n        \"cursor\"   => \"cursor://file/%file:%line\",\n    ];\n\n    /**\n     * @var TemplateHelper\n     */\n    protected $templateHelper;\n\n    /**\n     * Constructor.\n     *\n     * @return void\n     */\n    public function __construct()\n    {\n        if (ini_get('xdebug.file_link_format') || get_cfg_var('xdebug.file_link_format')) {\n            // Register editor using xdebug's file_link_format option.\n            $this->editors['xdebug'] = function ($file, $line) {\n                return str_replace(['%f', '%l'], [$file, $line], ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'));\n            };\n\n            // If xdebug is available, use it as default editor.\n            $this->setEditor('xdebug');\n        }\n\n        // Add the default, local resource search path:\n        $this->searchPaths[] = __DIR__ . \"/../Resources\";\n\n        // blacklist php provided auth based values\n        $this->blacklist('_SERVER', 'PHP_AUTH_PW');\n\n        $this->templateHelper = new TemplateHelper();\n\n        if (class_exists('Symfony\\Component\\VarDumper\\Cloner\\VarCloner')) {\n            $cloner = new VarCloner();\n            // Only dump object internals if a custom caster exists for performance reasons\n            // https://github.com/filp/whoops/pull/404\n            $cloner->addCasters(['*' => function ($obj, $a, $stub, $isNested, $filter = 0) {\n                $class = $stub->class;\n                $classes = [$class => $class] + class_parents($obj) + class_implements($obj);\n\n                foreach ($classes as $class) {\n                    if (isset(AbstractCloner::$defaultCasters[$class])) {\n                        return $a;\n                    }\n                }\n\n                // Remove all internals\n                return [];\n            }]);\n            $this->templateHelper->setCloner($cloner);\n        }\n    }\n\n    /**\n     * @return int|null\n     *\n     * @throws \\Exception\n     */\n    public function handle()\n    {\n        if (!$this->handleUnconditionally()) {\n            // Check conditions for outputting HTML:\n            // @todo: Make this more robust\n            if (PHP_SAPI === 'cli') {\n                // Help users who have been relying on an internal test value\n                // fix their code to the proper method\n                if (isset($_ENV['whoops-test'])) {\n                    throw new \\Exception(\n                        'Use handleUnconditionally instead of whoops-test'\n                        .' environment variable'\n                    );\n                }\n\n                return Handler::DONE;\n            }\n        }\n\n        $templateFile = $this->getResource(\"views/layout.html.php\");\n        $cssFile      = $this->getResource(\"css/whoops.base.css\");\n        $zeptoFile    = $this->getResource(\"js/zepto.min.js\");\n        $prismJs = $this->getResource(\"js/prism.js\");\n        $prismCss = $this->getResource(\"css/prism.css\");\n        $clipboard    = $this->getResource(\"js/clipboard.min.js\");\n        $jsFile       = $this->getResource(\"js/whoops.base.js\");\n\n        if ($this->customCss) {\n            $customCssFile = $this->getResource($this->customCss);\n        }\n\n        if ($this->customJs) {\n            $customJsFile = $this->getResource($this->customJs);\n        }\n\n        $inspector = $this->getInspector();\n        $frames = $this->getExceptionFrames();\n        $code = $this->getExceptionCode();\n\n        // List of variables that will be passed to the layout template.\n        $vars = [\n            \"page_title\" => $this->getPageTitle(),\n\n            // @todo: Asset compiler\n            \"stylesheet\" => file_get_contents($cssFile),\n            \"zepto\"      => file_get_contents($zeptoFile),\n            \"prismJs\"   => file_get_contents($prismJs),\n            \"prismCss\"   => file_get_contents($prismCss),\n            \"clipboard\"  => file_get_contents($clipboard),\n            \"javascript\" => file_get_contents($jsFile),\n\n            // Template paths:\n            \"header\"                     => $this->getResource(\"views/header.html.php\"),\n            \"header_outer\"               => $this->getResource(\"views/header_outer.html.php\"),\n            \"frame_list\"                 => $this->getResource(\"views/frame_list.html.php\"),\n            \"frames_description\"         => $this->getResource(\"views/frames_description.html.php\"),\n            \"frames_container\"           => $this->getResource(\"views/frames_container.html.php\"),\n            \"panel_details\"              => $this->getResource(\"views/panel_details.html.php\"),\n            \"panel_details_outer\"        => $this->getResource(\"views/panel_details_outer.html.php\"),\n            \"panel_left\"                 => $this->getResource(\"views/panel_left.html.php\"),\n            \"panel_left_outer\"           => $this->getResource(\"views/panel_left_outer.html.php\"),\n            \"frame_code\"                 => $this->getResource(\"views/frame_code.html.php\"),\n            \"env_details\"                => $this->getResource(\"views/env_details.html.php\"),\n\n            \"title\"            => $this->getPageTitle(),\n            \"name\"             => explode(\"\\\\\", $inspector->getExceptionName()),\n            \"message\"          => $inspector->getExceptionMessage(),\n            \"previousMessages\" => $inspector->getPreviousExceptionMessages(),\n            \"docref_url\"       => $inspector->getExceptionDocrefUrl(),\n            \"code\"             => $code,\n            \"previousCodes\"    => $inspector->getPreviousExceptionCodes(),\n            \"plain_exception\"  => Formatter::formatExceptionPlain($inspector),\n            \"frames\"           => $frames,\n            \"has_frames\"       => !!count($frames),\n            \"handler\"          => $this,\n            \"handlers\"         => $this->getRun()->getHandlers(),\n\n            \"active_frames_tab\" => count($frames) && $frames->offsetGet(0)->isApplication() ?  'application' : 'all',\n            \"has_frames_tabs\"   => $this->getApplicationPaths(),\n\n            \"tables\"      => [\n                \"GET Data\"              => $this->masked($_GET, '_GET'),\n                \"POST Data\"             => $this->masked($_POST, '_POST'),\n                \"Files\"                 => isset($_FILES) ? $this->masked($_FILES, '_FILES') : [],\n                \"Cookies\"               => $this->masked($_COOKIE, '_COOKIE'),\n                \"Session\"               => isset($_SESSION) ? $this->masked($_SESSION, '_SESSION') :  [],\n                \"Server/Request Data\"   => $this->masked($_SERVER, '_SERVER'),\n                \"Environment Variables\" => $this->masked($_ENV, '_ENV'),\n            ],\n        ];\n\n        if (isset($customCssFile)) {\n            $vars[\"stylesheet\"] .= file_get_contents($customCssFile);\n        }\n\n        if (isset($customJsFile)) {\n            $vars[\"javascript\"] .= file_get_contents($customJsFile);\n        }\n\n        // Add extra entries list of data tables:\n        // @todo: Consolidate addDataTable and addDataTableCallback\n        $extraTables = array_map(function ($table) use ($inspector) {\n            return $table instanceof \\Closure ? $table($inspector) : $table;\n        }, $this->getDataTables());\n        $vars[\"tables\"] = array_merge($extraTables, $vars[\"tables\"]);\n\n        $plainTextHandler = new PlainTextHandler();\n        $plainTextHandler->setRun($this->getRun());\n        $plainTextHandler->setException($this->getException());\n        $plainTextHandler->setInspector($this->getInspector());\n        $vars[\"preface\"] = \"<!--\\n\\n\\n\" .  $this->templateHelper->escape($plainTextHandler->generateResponse()) . \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n-->\";\n\n        $this->templateHelper->setVariables($vars);\n        $this->templateHelper->render($templateFile);\n\n        return Handler::QUIT;\n    }\n\n    /**\n     * Get the stack trace frames of the exception currently being handled.\n     *\n     * @return \\Whoops\\Exception\\FrameCollection\n     */\n    protected function getExceptionFrames()\n    {\n        $frames = $this->getInspector()->getFrames($this->getRun()->getFrameFilters());\n\n        if ($this->getApplicationPaths()) {\n            foreach ($frames as $frame) {\n                foreach ($this->getApplicationPaths() as $path) {\n                    if (strpos($frame->getFile(), $path) === 0) {\n                        $frame->setApplication(true);\n                        break;\n                    }\n                }\n            }\n        }\n\n        return $frames;\n    }\n\n    /**\n     * Get the code of the exception currently being handled.\n     *\n     * @return string\n     */\n    protected function getExceptionCode()\n    {\n        $exception = $this->getException();\n\n        $code = $exception->getCode();\n        if ($exception instanceof \\ErrorException) {\n            // ErrorExceptions wrap the php-error types within the 'severity' property\n            $code = Misc::translateErrorCode($exception->getSeverity());\n        }\n\n        return (string) $code;\n    }\n\n    /**\n     * @return string\n     */\n    public function contentType()\n    {\n        return 'text/html';\n    }\n\n    /**\n     * Adds an entry to the list of tables displayed in the template.\n     *\n     * The expected data is a simple associative array. Any nested arrays\n     * will be flattened with `print_r`.\n     *\n     * @param string $label\n     *\n     * @return static\n     */\n    public function addDataTable($label, array $data)\n    {\n        $this->extraTables[$label] = $data;\n        return $this;\n    }\n\n    /**\n     * Lazily adds an entry to the list of tables displayed in the table.\n     *\n     * The supplied callback argument will be called when the error is\n     * rendered, it should produce a simple associative array. Any nested\n     * arrays will be flattened with `print_r`.\n     *\n     * @param string   $label\n     * @param callable $callback Callable returning an associative array\n     *\n     * @throws InvalidArgumentException If $callback is not callable\n     *\n     * @return static\n     */\n    public function addDataTableCallback($label, /* callable */ $callback)\n    {\n        if (!is_callable($callback)) {\n            throw new InvalidArgumentException('Expecting callback argument to be callable');\n        }\n\n        $this->extraTables[$label] = function (?\\Whoops\\Inspector\\InspectorInterface $inspector = null) use ($callback) {\n            try {\n                $result = call_user_func($callback, $inspector);\n\n                // Only return the result if it can be iterated over by foreach().\n                return is_array($result) || $result instanceof \\Traversable ? $result : [];\n            } catch (\\Exception $e) {\n                // Don't allow failure to break the rendering of the original exception.\n                return [];\n            }\n        };\n\n        return $this;\n    }\n\n    /**\n     * Returns all the extra data tables registered with this handler.\n     *\n     * Optionally accepts a 'label' parameter, to only return the data table\n     * under that label.\n     *\n     * @param string|null $label\n     *\n     * @return array[]|callable\n     */\n    public function getDataTables($label = null)\n    {\n        if ($label !== null) {\n            return isset($this->extraTables[$label]) ?\n                   $this->extraTables[$label] : [];\n        }\n\n        return $this->extraTables;\n    }\n\n    /**\n     * Set whether to handle unconditionally.\n     *\n     * Allows to disable all attempts to dynamically decide whether to handle\n     * or return prematurely. Set this to ensure that the handler will perform,\n     * no matter what.\n     *\n     * @param bool|null $value\n     *\n     * @return bool|static\n     */\n    public function handleUnconditionally($value = null)\n    {\n        if (func_num_args() == 0) {\n            return $this->handleUnconditionally;\n        }\n\n        $this->handleUnconditionally = (bool) $value;\n        return $this;\n    }\n\n    /**\n     * Adds an editor resolver.\n     *\n     * Either a string, or a closure that resolves a string, that can be used\n     * to open a given file in an editor. If the string contains the special\n     * substrings %file or %line, they will be replaced with the correct data.\n     *\n     * @example\n     *  $run->addEditor('macvim', \"mvim://open?url=file://%file&line=%line\")\n     * @example\n     *   $run->addEditor('remove-it', function($file, $line) {\n     *       unlink($file);\n     *       return \"http://stackoverflow.com\";\n     *   });\n     *\n     * @param string          $identifier\n     * @param string|callable $resolver\n     *\n     * @return static\n     */\n    public function addEditor($identifier, $resolver)\n    {\n        $this->editors[$identifier] = $resolver;\n        return $this;\n    }\n\n    /**\n     * Set the editor to use to open referenced files.\n     *\n     * Pass either the name of a configured editor, or a closure that directly\n     * resolves an editor string.\n     *\n     * @example\n     *   $run->setEditor(function($file, $line) { return \"file:///{$file}\"; });\n     * @example\n     *   $run->setEditor('sublime');\n     *\n     * @param string|callable $editor\n     *\n     * @throws InvalidArgumentException If invalid argument identifier provided\n     *\n     * @return static\n     */\n    public function setEditor($editor)\n    {\n        if (!is_callable($editor) && !isset($this->editors[$editor])) {\n            throw new InvalidArgumentException(\n                \"Unknown editor identifier: $editor. Known editors:\" .\n                implode(\",\", array_keys($this->editors))\n            );\n        }\n\n        $this->editor = $editor;\n        return $this;\n    }\n\n    /**\n     * Get the editor href for a given file and line, if available.\n     *\n     * @param string $filePath\n     * @param int    $line\n     *\n     * @throws InvalidArgumentException If editor resolver does not return a string\n     *\n     * @return string|bool\n     */\n    public function getEditorHref($filePath, $line)\n    {\n        $editor = $this->getEditor($filePath, $line);\n\n        if (empty($editor)) {\n            return false;\n        }\n\n        // Check that the editor is a string, and replace the\n        // %line and %file placeholders:\n        if (!isset($editor['url']) || !is_string($editor['url'])) {\n            throw new UnexpectedValueException(\n                __METHOD__ . \" should always resolve to a string or a valid editor array; got something else instead.\"\n            );\n        }\n\n        $editor['url'] = str_replace(\"%line\", rawurlencode($line), $editor['url']);\n        $editor['url'] = str_replace(\"%file\", rawurlencode($filePath), $editor['url']);\n\n        return $editor['url'];\n    }\n\n    /**\n     * Determine if the editor link should act as an Ajax request.\n     *\n     * @param string $filePath\n     * @param int    $line\n     *\n     * @throws UnexpectedValueException If editor resolver does not return a boolean\n     *\n     * @return bool\n     */\n    public function getEditorAjax($filePath, $line)\n    {\n        $editor = $this->getEditor($filePath, $line);\n\n        // Check that the ajax is a bool\n        if (!isset($editor['ajax']) || !is_bool($editor['ajax'])) {\n            throw new UnexpectedValueException(\n                __METHOD__ . \" should always resolve to a bool; got something else instead.\"\n            );\n        }\n        return $editor['ajax'];\n    }\n\n    /**\n     * Determines both the editor and if ajax should be used.\n     *\n     * @param string $filePath\n     * @param int    $line\n     *\n     * @return array\n     */\n    protected function getEditor($filePath, $line)\n    {\n        if (!$this->editor || (!is_string($this->editor) && !is_callable($this->editor))) {\n            return [];\n        }\n\n        if (is_string($this->editor) && isset($this->editors[$this->editor]) && !is_callable($this->editors[$this->editor])) {\n            return [\n                'ajax' => false,\n                'url' => $this->editors[$this->editor],\n            ];\n        }\n\n        if (is_callable($this->editor) || (isset($this->editors[$this->editor]) && is_callable($this->editors[$this->editor]))) {\n            if (is_callable($this->editor)) {\n                $callback = call_user_func($this->editor, $filePath, $line);\n            } else {\n                $callback = call_user_func($this->editors[$this->editor], $filePath, $line);\n            }\n\n            if (empty($callback)) {\n                return [];\n            }\n\n            if (is_string($callback)) {\n                return [\n                    'ajax' => false,\n                    'url' => $callback,\n                ];\n            }\n\n            return [\n                'ajax' => isset($callback['ajax']) ? $callback['ajax'] : false,\n                'url' => isset($callback['url']) ? $callback['url'] : $callback,\n            ];\n        }\n\n        return [];\n    }\n\n    /**\n     * Set the page title.\n     *\n     * @param string $title\n     *\n     * @return static\n     */\n    public function setPageTitle($title)\n    {\n        $this->pageTitle = (string) $title;\n        return $this;\n    }\n\n    /**\n     * Get the page title.\n     *\n     * @return string\n     */\n    public function getPageTitle()\n    {\n        return $this->pageTitle;\n    }\n\n    /**\n     * Adds a path to the list of paths to be searched for resources.\n     *\n     * @param string $path\n     *\n     * @throws InvalidArgumentException If $path is not a valid directory\n     *\n     * @return static\n     */\n    public function addResourcePath($path)\n    {\n        if (!is_dir($path)) {\n            throw new InvalidArgumentException(\n                \"'$path' is not a valid directory\"\n            );\n        }\n\n        array_unshift($this->searchPaths, $path);\n        return $this;\n    }\n\n    /**\n     * Adds a custom css file to be loaded.\n     *\n     * @param string|null $name\n     *\n     * @return static\n     */\n    public function addCustomCss($name)\n    {\n        $this->customCss = $name;\n        return $this;\n    }\n\n    /**\n     * Adds a custom js file to be loaded.\n     *\n     * @param string|null $name\n     *\n     * @return static\n     */\n    public function addCustomJs($name)\n    {\n        $this->customJs = $name;\n        return $this;\n    }\n\n    /**\n     * @return array\n     */\n    public function getResourcePaths()\n    {\n        return $this->searchPaths;\n    }\n\n    /**\n     * Finds a resource, by its relative path, in all available search paths.\n     *\n     * The search is performed starting at the last search path, and all the\n     * way back to the first, enabling a cascading-type system of overrides for\n     * all resources.\n     *\n     * @param string $resource\n     *\n     * @throws RuntimeException If resource cannot be found in any of the available paths\n     *\n     * @return string\n     */\n    protected function getResource($resource)\n    {\n        // If the resource was found before, we can speed things up\n        // by caching its absolute, resolved path:\n        if (isset($this->resourceCache[$resource])) {\n            return $this->resourceCache[$resource];\n        }\n\n        // Search through available search paths, until we find the\n        // resource we're after:\n        foreach ($this->searchPaths as $path) {\n            $fullPath = $path . \"/$resource\";\n\n            if (is_file($fullPath)) {\n                // Cache the result:\n                $this->resourceCache[$resource] = $fullPath;\n                return $fullPath;\n            }\n        }\n\n        // If we got this far, nothing was found.\n        throw new RuntimeException(\n            \"Could not find resource '$resource' in any resource paths.\"\n            . \"(searched: \" . join(\", \", $this->searchPaths). \")\"\n        );\n    }\n\n    /**\n     * @deprecated\n     *\n     * @return string\n     */\n    public function getResourcesPath()\n    {\n        $allPaths = $this->getResourcePaths();\n\n        // Compat: return only the first path added\n        return end($allPaths) ?: null;\n    }\n\n    /**\n     * @deprecated\n     *\n     * @param string $resourcesPath\n     *\n     * @return static\n     */\n    public function setResourcesPath($resourcesPath)\n    {\n        $this->addResourcePath($resourcesPath);\n        return $this;\n    }\n\n    /**\n     * Return the application paths.\n     *\n     * @return array\n     */\n    public function getApplicationPaths()\n    {\n        return $this->applicationPaths;\n    }\n\n    /**\n     * Set the application paths.\n     *\n     * @return void\n     */\n    public function setApplicationPaths(array $applicationPaths)\n    {\n        $this->applicationPaths = $applicationPaths;\n    }\n\n    /**\n     * Set the application root path.\n     *\n     * @param string $applicationRootPath\n     *\n     * @return void\n     */\n    public function setApplicationRootPath($applicationRootPath)\n    {\n        $this->templateHelper->setApplicationRootPath($applicationRootPath);\n    }\n\n    /**\n     * blacklist a sensitive value within one of the superglobal arrays.\n     * Alias for the hideSuperglobalKey method.\n     *\n     * @param string $superGlobalName The name of the superglobal array, e.g. '_GET'\n     * @param string $key             The key within the superglobal\n     * @see hideSuperglobalKey\n     *\n     * @return static\n     */\n    public function blacklist($superGlobalName, $key)\n    {\n        $this->blacklist[$superGlobalName][] = $key;\n        return $this;\n    }\n\n    /**\n     * Hide a sensitive value within one of the superglobal arrays.\n     *\n     * @param string $superGlobalName The name of the superglobal array, e.g. '_GET'\n     * @param string $key             The key within the superglobal\n     * @return static\n     */\n    public function hideSuperglobalKey($superGlobalName, $key)\n    {\n        return $this->blacklist($superGlobalName, $key);\n    }\n\n    /**\n     * Checks all values within the given superGlobal array.\n     *\n     * Blacklisted values will be replaced by a equal length string containing\n     * only '*' characters for string values.\n     * Non-string values will be replaced with a fixed asterisk count.\n     * We intentionally dont rely on $GLOBALS as it depends on the 'auto_globals_jit' php.ini setting.\n     *\n     * @param array|\\ArrayAccess  $superGlobal     One of the superglobal arrays\n     * @param string $superGlobalName The name of the superglobal array, e.g. '_GET'\n     *\n     * @return array $values without sensitive data\n     */\n    private function masked($superGlobal, $superGlobalName)\n    {\n        $blacklisted = $this->blacklist[$superGlobalName];\n\n        $values = $superGlobal;\n\n        foreach ($blacklisted as $key) {\n            if (isset($superGlobal[$key])) {\n                $values[$key] = str_repeat('*', is_string($superGlobal[$key]) ? strlen($superGlobal[$key]) : 3);\n            }\n        }\n\n        return $values;\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Handler/XmlResponseHandler.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Handler;\n\nuse SimpleXMLElement;\nuse Whoops\\Exception\\Formatter;\n\n/**\n * Catches an exception and converts it to an XML\n * response. Additionally can also return exception\n * frames for consumption by an API.\n */\nclass XmlResponseHandler extends Handler\n{\n    /**\n     * @var bool\n     */\n    private $returnFrames = false;\n\n    /**\n     * @param  bool|null  $returnFrames\n     * @return bool|static\n     */\n    public function addTraceToOutput($returnFrames = null)\n    {\n        if (func_num_args() == 0) {\n            return $this->returnFrames;\n        }\n\n        $this->returnFrames = (bool) $returnFrames;\n        return $this;\n    }\n\n    /**\n     * @return int\n     */\n    public function handle()\n    {\n        $response = [\n            'error' => Formatter::formatExceptionAsDataArray(\n                $this->getInspector(),\n                $this->addTraceToOutput(),\n                $this->getRun()->getFrameFilters()\n            ),\n        ];\n\n        echo self::toXml($response);\n\n        return Handler::QUIT;\n    }\n\n    /**\n     * @return string\n     */\n    public function contentType()\n    {\n        return 'application/xml';\n    }\n\n    /**\n     * @param  SimpleXMLElement  $node Node to append data to, will be modified in place\n     * @param  array|\\Traversable $data\n     * @return SimpleXMLElement  The modified node, for chaining\n     */\n    private static function addDataToNode(\\SimpleXMLElement $node, $data)\n    {\n        assert(is_array($data) || $data instanceof Traversable);\n\n        foreach ($data as $key => $value) {\n            if (is_numeric($key)) {\n                // Convert the key to a valid string\n                $key = \"unknownNode_\". (string) $key;\n            }\n\n            // Delete any char not allowed in XML element names\n            $key = preg_replace('/[^a-z0-9\\-\\_\\.\\:]/i', '', $key);\n\n            if (is_array($value)) {\n                $child = $node->addChild($key);\n                self::addDataToNode($child, $value);\n            } else {\n                $value = str_replace('&', '&amp;', print_r($value, true));\n                $node->addChild($key, $value);\n            }\n        }\n\n        return $node;\n    }\n\n    /**\n     * The main function for converting to an XML document.\n     *\n     * @param  array|\\Traversable $data\n     * @return string            XML\n     */\n    private static function toXml($data)\n    {\n        assert(is_array($data) || $data instanceof Traversable);\n\n        $node = simplexml_load_string(\"<?xml version='1.0' encoding='utf-8'?><root />\");\n\n        return self::addDataToNode($node, $data)->asXML();\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Inspector/InspectorFactory.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Inspector;\n\nuse Whoops\\Exception\\Inspector;\n\nclass InspectorFactory implements InspectorFactoryInterface\n{\n    /**\n     * @param \\Throwable $exception\n     * @return InspectorInterface\n     */\n    public function create($exception)\n    {\n        return new Inspector($exception, $this);\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Inspector/InspectorFactoryInterface.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Inspector;\n\ninterface InspectorFactoryInterface\n{\n    /**\n     * @param \\Throwable $exception\n     * @return InspectorInterface\n     */\n    public function create($exception);\n}\n"
  },
  {
    "path": "src/Whoops/Inspector/InspectorInterface.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Inspector;\n\ninterface InspectorInterface\n{\n    /**\n     * @return \\Throwable\n     */\n    public function getException();\n\n    /**\n     * @return string\n     */\n    public function getExceptionName();\n\n    /**\n     * @return string\n     */\n    public function getExceptionMessage();\n\n    /**\n     * @return string[]\n     */\n    public function getPreviousExceptionMessages();\n\n    /**\n     * @return int[]\n     */\n    public function getPreviousExceptionCodes();\n\n    /**\n     * Returns a url to the php-manual related to the underlying error - when available.\n     *\n     * @return string|null\n     */\n    public function getExceptionDocrefUrl();\n\n    /**\n     * Does the wrapped Exception has a previous Exception?\n     * @return bool\n     */\n    public function hasPreviousException();\n\n    /**\n     * Returns an Inspector for a previous Exception, if any.\n     * @todo   Clean this up a bit, cache stuff a bit better.\n     * @return InspectorInterface\n     */\n    public function getPreviousExceptionInspector();\n\n    /**\n     * Returns an array of all previous exceptions for this inspector's exception\n     * @return \\Throwable[]\n     */\n    public function getPreviousExceptions();\n\n    /**\n     * Returns an iterator for the inspected exception's\n     * frames.\n     * \n     * @param array<callable> $frameFilters\n     * \n     * @return \\Whoops\\Exception\\FrameCollection\n     */\n    public function getFrames(array $frameFilters = []);\n}\n"
  },
  {
    "path": "src/Whoops/Resources/css/prism.css",
    "content": "/* PrismJS 1.30.0\nhttps://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+markup-templating+php&plugins=line-highlight+line-numbers */\ncode[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green}\npre[data-line]{position:relative;padding:1em 0 1em 3em}.line-highlight{position:absolute;left:0;right:0;padding:inherit 0;margin-top:1em;background:hsla(24,20%,50%,.08);background:linear-gradient(to right,hsla(24,20%,50%,.1) 70%,hsla(24,20%,50%,0));pointer-events:none;line-height:inherit;white-space:pre}@media print{.line-highlight{-webkit-print-color-adjust:exact;color-adjust:exact}}.line-highlight:before,.line-highlight[data-end]:after{content:attr(data-start);position:absolute;top:.4em;left:.6em;min-width:1em;padding:0 .5em;background-color:hsla(24,20%,50%,.4);color:#f4f1ef;font:bold 65%/1.5 sans-serif;text-align:center;vertical-align:.3em;border-radius:999px;text-shadow:none;box-shadow:0 1px #fff}.line-highlight[data-end]:after{content:attr(data-end);top:auto;bottom:.4em}.line-numbers .line-highlight:after,.line-numbers .line-highlight:before{content:none}pre[id].linkable-line-numbers span.line-numbers-rows{pointer-events:all}pre[id].linkable-line-numbers span.line-numbers-rows>span:before{cursor:pointer}pre[id].linkable-line-numbers span.line-numbers-rows>span:hover:before{background-color:rgba(128,128,128,.2)}\npre[class*=language-].line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}\n"
  },
  {
    "path": "src/Whoops/Resources/css/whoops.base.css",
    "content": "body {\n  font: 12px \"Helvetica Neue\", helvetica, arial, sans-serif;\n  color: #131313;\n  background: #eeeeee;\n  padding:0;\n  margin: 0;\n  max-height: 100%;\n\n  text-rendering: optimizeLegibility;\n}\n  a {\n    text-decoration: none;\n  }\n\n.Whoops.container {\n    position: relative;\n    z-index: 9999999999;\n}\n\n.panel {\n    overflow-y: scroll;\n    height: 100%;\n    position: fixed;\n    margin: 0;\n    left: 0;\n    top: 0;\n}\n\n.branding {\n  position: absolute;\n  top: 10px;\n  right: 20px;\n  color: #777777;\n  font-size: 10px;\n    z-index: 100;\n}\n  .branding a {\n    color: #e95353;\n  }\n\nheader {\n  color: white;\n  box-sizing: border-box;\n  background-color: #2a2a2a;\n  padding: 35px 40px;\n  max-height: 180px;\n  overflow: hidden;\n  transition: 0.5s;\n}\n\n  header.header-expand {\n    max-height: 1000px;\n  }\n\n  .exc-title {\n    margin: 0;\n    color: #bebebe;\n    font-size: 14px;\n  }\n    .exc-title-primary, .exc-title-secondary {\n      color: #e95353;\n    }\n\n    .exc-message {\n      font-size: 20px;\n      word-wrap: break-word;\n      margin: 4px 0 0 0;\n      color: white;\n    }\n      .exc-message span {\n        display: block;\n      }\n      .exc-message-empty-notice {\n        color: #a29d9d;\n        font-weight: 300;\n      }\n\n.prev-exc-title {\n  margin: 10px 0;\n}\n\n.prev-exc-title + ul {\n  margin: 0;\n  padding: 0 0 0 20px;\n  line-height: 12px;\n}\n\n.prev-exc-title + ul li {\n  font: 12px \"Helvetica Neue\", helvetica, arial, sans-serif;\n}\n\n.prev-exc-title + ul li .prev-exc-code {\n  display: inline-block;\n  color: #bebebe;\n}\n\n.details-container {\n  left: 30%;\n  width: 70%;\n  background: #fafafa;\n}\n  .details {\n    padding: 5px;\n  }\n\n    .details-heading {\n      color: #4288CE;\n      font-weight: 300;\n      padding-bottom: 10px;\n      margin-bottom: 10px;\n      border-bottom: 1px solid rgba(0, 0, 0, .1);\n    }\n\n    .details pre.sf-dump {\n      white-space: pre;\n      word-wrap: inherit;\n    }\n\n    .details pre.sf-dump,\n    .details pre.sf-dump .sf-dump-num,\n    .details pre.sf-dump .sf-dump-const,\n    .details pre.sf-dump .sf-dump-str,\n    .details pre.sf-dump .sf-dump-note,\n    .details pre.sf-dump .sf-dump-ref,\n    .details pre.sf-dump .sf-dump-public,\n    .details pre.sf-dump .sf-dump-protected,\n    .details pre.sf-dump .sf-dump-private,\n    .details pre.sf-dump .sf-dump-meta,\n    .details pre.sf-dump .sf-dump-key,\n    .details pre.sf-dump .sf-dump-index {\n      color: #463C54;\n    }\n\n.left-panel {\n  width: 30%;\n  background: #ded8d8;\n}\n\n  .frames-description {\n    background: rgba(0, 0, 0, .05);\n    padding: 8px 15px;\n    color: #a29d9d;\n    font-size: 11px;\n  }\n\n  .frames-description.frames-description-application {\n    text-align: center;\n    font-size: 12px;\n  }\n  .frames-container.frames-container-application .frame:not(.frame-application) {\n    display: none;\n  }\n\n  .frames-tab {\n    color: #a29d9d;\n    display: inline-block;\n    padding: 4px 8px;\n    margin: 0 2px;\n    border-radius: 3px;\n  }\n\n  .frames-tab.frames-tab-active {\n    background-color: #2a2a2a;\n    color: #bebebe;\n  }\n\n  .frame {\n    padding: 14px;\n    cursor: pointer;\n    transition: all 0.1s ease;\n    background: #eeeeee;\n  }\n    .frame:not(:last-child) {\n      border-bottom: 1px solid rgba(0, 0, 0, .05);\n    }\n\n    .frame.active {\n      box-shadow: inset -5px 0 0 0 #4288CE;\n      color: #4288CE;\n    }\n\n    .frame:not(.active):hover {\n      background: #BEE9EA;\n    }\n\n    .frame-method-info {\n      margin-bottom: 10px;\n    }\n\n    .frame-class, .frame-function, .frame-index {\n      font-size: 14px;\n    }\n\n    .frame-index {\n      float: left;\n    }\n\n    .frame-method-info {\n      margin-left: 24px;\n    }\n\n    .frame-index {\n      font-size: 11px;\n      color: #a29d9d;\n      background-color: rgba(0, 0, 0, .05);\n      height: 18px;\n      width: 18px;\n      line-height: 18px;\n      border-radius: 5px;\n      padding: 0 1px 0 1px;\n      text-align: center;\n      display: inline-block;\n    }\n\n    .frame-application .frame-index {\n      background-color: #2a2a2a;\n      color: #bebebe;\n    }\n\n    .frame-file {\n      font-family: \"Inconsolata\", \"Fira Mono\", \"Source Code Pro\", Monaco, Consolas, \"Lucida Console\", monospace;\n      color: #a29d9d;\n    }\n\n      .frame-file .editor-link {\n        color: #a29d9d;\n      }\n\n    .frame-line {\n      font-weight: bold;\n    }\n\n    .frame-code {\n      padding: 5px;\n      background: #303030;\n      display: none;\n    }\n\n    .frame-code.active {\n      display: block;\n    }\n\n    .frame-code .frame-file {\n      color: #a29d9d;\n      padding: 12px 6px;\n\n      border-bottom: none;\n    }\n\n    .code-block {\n      padding: 10px;\n      margin: 0;\n      border-radius: 6px;\n      box-shadow: 0 3px 0 rgba(0, 0, 0, .05),\n                  0 10px 30px rgba(0, 0, 0, .05),\n                  inset 0 0 1px 0 rgba(255, 255, 255, .07);\n      -moz-tab-size: 4;\n      -o-tab-size: 4;\n      tab-size: 4;\n    }\n\n    .linenums {\n      margin: 0;\n      margin-left: 10px;\n    }\n\n    .frame-comments {\n      border-top: none;\n      margin-top: 15px;\n\n      font-size: 12px;\n    }\n\n    .frame-comments.empty {\n    }\n\n    .frame-comments.empty:before {\n      content: \"No comments for this stack frame.\";\n      font-weight: 300;\n      color: #a29d9d;\n    }\n\n    .frame-comment {\n      padding: 10px;\n      color: #e3e3e3;\n      border-radius: 6px;\n      background-color: rgba(255, 255, 255, .05);\n    }\n\n    .frame-comment a {\n      font-weight: bold;\n      text-decoration: underline;\n      color: #c6c6c6;\n    }\n\n    .frame-comment:not(:last-child) {\n      border-bottom: 1px dotted rgba(0, 0, 0, .3);\n    }\n\n    .frame-comment-context {\n      font-size: 10px;\n      color: white;\n    }\n\n.delimiter {\n  display: inline-block;\n}\n\n.data-table-container label {\n  font-size: 16px;\n  color: #303030;\n  font-weight: bold;\n  margin: 10px 0;\n\n  display: block;\n\n  margin-bottom: 5px;\n  padding-bottom: 5px;\n}\n  .data-table {\n    width: 100%;\n    margin-bottom: 10px;\n  }\n\n  .data-table tbody {\n    font: 13px \"Inconsolata\", \"Fira Mono\", \"Source Code Pro\", Monaco, Consolas, \"Lucida Console\", monospace;\n  }\n\n  .data-table thead {\n    display: none;\n  }\n\n  .data-table tr {\n    padding: 5px 0;\n  }\n\n  .data-table td:first-child {\n    width: 20%;\n    min-width: 130px;\n    overflow: hidden;\n    font-weight: bold;\n    color: #463C54;\n    padding-right: 5px;\n\n  }\n\n  .data-table td:last-child {\n    width: 80%;\n    -ms-word-break: break-all;\n    word-break: break-all;\n    word-break: break-word;\n    -webkit-hyphens: auto;\n    -moz-hyphens: auto;\n    hyphens: auto;\n  }\n\n  .data-table span.empty {\n    color: rgba(0, 0, 0, .3);\n    font-weight: 300;\n  }\n  .data-table label.empty {\n    display: inline;\n  }\n\n.handler {\n  padding: 4px 0;\n  font: 14px \"Inconsolata\", \"Fira Mono\", \"Source Code Pro\", Monaco, Consolas, \"Lucida Console\", monospace;\n}\n\n#plain-exception {\n  display: none;\n}\n\n.rightButton {\n  cursor: pointer;\n  border: 0;\n  opacity: .8;\n  background: none;\n\n  color: rgba(255, 255, 255, 0.1);\n  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);\n\n  border-radius: 3px;\n\n  outline: none !important;\n}\n\n  .rightButton:hover {\n    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3);\n    color: rgba(255, 255, 255, 0.3);\n  }\n\n/* inspired by githubs kbd styles */\nkbd {\n  -moz-border-bottom-colors: none;\n  -moz-border-left-colors: none;\n  -moz-border-right-colors: none;\n  -moz-border-top-colors: none;\n  background-color: #fcfcfc;\n  border-color: #ccc #ccc #bbb;\n  border-image: none;\n  border-style: solid;\n  border-width: 1px;\n  color: #555;\n  display: inline-block;\n  font-size: 11px;\n  line-height: 10px;\n  padding: 3px 5px;\n  vertical-align: middle;\n}\n\n\n/* == Media queries */\n\n/* Expand the spacing in the details section */\n@media (min-width: 1000px) {\n  .details, .frame-code {\n    padding: 20px 40px;\n  }\n\n  .details-container {\n    left: 32%;\n    width: 68%;\n  }\n\n  .frames-container {\n    margin: 5px;\n  }\n\n  .left-panel {\n    width: 32%;\n  }\n}\n\n/* Stack panels */\n@media (max-width: 600px) {\n  .panel {\n    position: static;\n    width: 100%;\n  }\n}\n\n/* Stack details tables */\n@media (max-width: 400px) {\n  .data-table,\n  .data-table tbody,\n  .data-table tbody tr,\n  .data-table tbody td {\n    display: block;\n    width: 100%;\n  }\n\n    .data-table tbody tr:first-child {\n      padding-top: 0;\n    }\n\n      .data-table tbody td:first-child,\n      .data-table tbody td:last-child {\n        padding-left: 0;\n        padding-right: 0;\n      }\n\n      .data-table tbody td:last-child {\n        padding-top: 3px;\n      }\n}\n\n.tooltipped {\n  position: relative\n}\n.tooltipped:after {\n  position: absolute;\n  z-index: 1000000;\n  display: none;\n  padding: 5px 8px;\n  color: #fff;\n  text-align: center;\n  text-decoration: none;\n  text-shadow: none;\n  text-transform: none;\n  letter-spacing: normal;\n  word-wrap: break-word;\n  white-space: pre;\n  pointer-events: none;\n  content: attr(aria-label);\n  background: rgba(0, 0, 0, 0.8);\n  border-radius: 3px;\n  -webkit-font-smoothing: subpixel-antialiased\n}\n.tooltipped:before {\n  position: absolute;\n  z-index: 1000001;\n  display: none;\n  width: 0;\n  height: 0;\n  color: rgba(0, 0, 0, 0.8);\n  pointer-events: none;\n  content: \"\";\n  border: 5px solid transparent\n}\n.tooltipped:hover:before,\n.tooltipped:hover:after,\n.tooltipped:active:before,\n.tooltipped:active:after,\n.tooltipped:focus:before,\n.tooltipped:focus:after {\n  display: inline-block;\n  text-decoration: none\n}\n.tooltipped-s:after {\n  top: 100%;\n  right: 50%;\n  margin-top: 5px\n}\n.tooltipped-s:before {\n  top: auto;\n  right: 50%;\n  bottom: -5px;\n  margin-right: -5px;\n  border-bottom-color: rgba(0, 0, 0, 0.8)\n}\n\npre.sf-dump {\n  padding: 0px !important;\n  margin: 0px !important;\n}\n\n.search-for-help {\n  width: 85%;\n  padding: 0;\n  margin: 10px 0;\n  list-style-type: none;\n  display: inline-block;\n}\n  .search-for-help li {\n    display: inline-block;\n    margin-right: 5px;\n  }\n  .search-for-help li:last-child {\n    margin-right: 0;\n  }\n    .search-for-help li a {\n\n    }\n      .search-for-help li a i {\n        width: 16px;\n        height: 16px;\n        overflow: hidden;\n        display: block;\n      }\n      .search-for-help li a svg {\n        fill: #fff;\n      }\n      .search-for-help li a svg path {\n        background-size: contain;\n      }\n\n.line-numbers-rows span {\n  pointer-events: auto;\n  cursor: pointer;\n}\n.line-numbers-rows span:hover {\n  text-decoration: underline;\n}\n"
  },
  {
    "path": "src/Whoops/Resources/js/prism.js",
    "content": "/* PrismJS 1.30.0\nhttps://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+markup-templating+php&plugins=line-highlight+line-numbers */\nvar _self=\"undefined\"!=typeof window?window:\"undefined\"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(e){var n=/(?:^|\\s)lang(?:uage)?-([\\w-]+)(?=\\s|$)/i,t=0,r={},a={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof i?new i(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/\\u00a0/g,\" \")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,\"__id\",{value:++t}),e.__id},clone:function e(n,t){var r,i;switch(t=t||{},a.util.type(n)){case\"Object\":if(i=a.util.objId(n),t[i])return t[i];for(var l in r={},t[i]=r,n)n.hasOwnProperty(l)&&(r[l]=e(n[l],t));return r;case\"Array\":return i=a.util.objId(n),t[i]?t[i]:(r=[],t[i]=r,n.forEach((function(n,a){r[a]=e(n,t)})),r);default:return n}},getLanguage:function(e){for(;e;){var t=n.exec(e.className);if(t)return t[1].toLowerCase();e=e.parentElement}return\"none\"},setLanguage:function(e,t){e.className=e.className.replace(RegExp(n,\"gi\"),\"\"),e.classList.add(\"language-\"+t)},currentScript:function(){if(\"undefined\"==typeof document)return null;if(document.currentScript&&\"SCRIPT\"===document.currentScript.tagName)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\\r\\n]*\\((.*):[^:]+:[^:]+\\)$/i.exec(r.stack)||[])[1];if(e){var n=document.getElementsByTagName(\"script\");for(var t in n)if(n[t].src==e)return n[t]}return null}},isActive:function(e,n,t){for(var r=\"no-\"+n;e;){var a=e.classList;if(a.contains(n))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!t}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,n){var t=a.util.clone(a.languages[e]);for(var r in n)t[r]=n[r];return t},insertBefore:function(e,n,t,r){var i=(r=r||a.languages)[e],l={};for(var o in i)if(i.hasOwnProperty(o)){if(o==n)for(var s in t)t.hasOwnProperty(s)&&(l[s]=t[s]);t.hasOwnProperty(o)||(l[o]=i[o])}var u=r[e];return r[e]=l,a.languages.DFS(a.languages,(function(n,t){t===u&&n!=e&&(this[n]=l)})),l},DFS:function e(n,t,r,i){i=i||{};var l=a.util.objId;for(var o in n)if(n.hasOwnProperty(o)){t.call(n,o,n[o],r||o);var s=n[o],u=a.util.type(s);\"Object\"!==u||i[l(s)]?\"Array\"!==u||i[l(s)]||(i[l(s)]=!0,e(s,t,o,i)):(i[l(s)]=!0,e(s,t,null,i))}}},plugins:{},highlightAll:function(e,n){a.highlightAllUnder(document,e,n)},highlightAllUnder:function(e,n,t){var r={callback:t,container:e,selector:'code[class*=\"language-\"], [class*=\"language-\"] code, code[class*=\"lang-\"], [class*=\"lang-\"] code'};a.hooks.run(\"before-highlightall\",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),a.hooks.run(\"before-all-elements-highlight\",r);for(var i,l=0;i=r.elements[l++];)a.highlightElement(i,!0===n,r.callback)},highlightElement:function(n,t,r){var i=a.util.getLanguage(n),l=a.languages[i];a.util.setLanguage(n,i);var o=n.parentElement;o&&\"pre\"===o.nodeName.toLowerCase()&&a.util.setLanguage(o,i);var s={element:n,language:i,grammar:l,code:n.textContent};function u(e){s.highlightedCode=e,a.hooks.run(\"before-insert\",s),s.element.innerHTML=s.highlightedCode,a.hooks.run(\"after-highlight\",s),a.hooks.run(\"complete\",s),r&&r.call(s.element)}if(a.hooks.run(\"before-sanity-check\",s),(o=s.element.parentElement)&&\"pre\"===o.nodeName.toLowerCase()&&!o.hasAttribute(\"tabindex\")&&o.setAttribute(\"tabindex\",\"0\"),!s.code)return a.hooks.run(\"complete\",s),void(r&&r.call(s.element));if(a.hooks.run(\"before-highlight\",s),s.grammar)if(t&&e.Worker){var c=new Worker(a.filename);c.onmessage=function(e){u(e.data)},c.postMessage(JSON.stringify({language:s.language,code:s.code,immediateClose:!0}))}else u(a.highlight(s.code,s.grammar,s.language));else u(a.util.encode(s.code))},highlight:function(e,n,t){var r={code:e,grammar:n,language:t};if(a.hooks.run(\"before-tokenize\",r),!r.grammar)throw new Error('The language \"'+r.language+'\" has no grammar.');return r.tokens=a.tokenize(r.code,r.grammar),a.hooks.run(\"after-tokenize\",r),i.stringify(a.util.encode(r.tokens),r.language)},tokenize:function(e,n){var t=n.rest;if(t){for(var r in t)n[r]=t[r];delete n.rest}var a=new s;return u(a,a.head,e),o(e,a,n,a.head,0),function(e){for(var n=[],t=e.head.next;t!==e.tail;)n.push(t.value),t=t.next;return n}(a)},hooks:{all:{},add:function(e,n){var t=a.hooks.all;t[e]=t[e]||[],t[e].push(n)},run:function(e,n){var t=a.hooks.all[e];if(t&&t.length)for(var r,i=0;r=t[i++];)r(n)}},Token:i};function i(e,n,t,r){this.type=e,this.content=n,this.alias=t,this.length=0|(r||\"\").length}function l(e,n,t,r){e.lastIndex=n;var a=e.exec(t);if(a&&r&&a[1]){var i=a[1].length;a.index+=i,a[0]=a[0].slice(i)}return a}function o(e,n,t,r,s,g){for(var f in t)if(t.hasOwnProperty(f)&&t[f]){var h=t[f];h=Array.isArray(h)?h:[h];for(var d=0;d<h.length;++d){if(g&&g.cause==f+\",\"+d)return;var v=h[d],p=v.inside,m=!!v.lookbehind,y=!!v.greedy,k=v.alias;if(y&&!v.pattern.global){var x=v.pattern.toString().match(/[imsuy]*$/)[0];v.pattern=RegExp(v.pattern.source,x+\"g\")}for(var b=v.pattern||v,w=r.next,A=s;w!==n.tail&&!(g&&A>=g.reach);A+=w.value.length,w=w.next){var P=w.value;if(n.length>e.length)return;if(!(P instanceof i)){var E,S=1;if(y){if(!(E=l(b,A,e,m))||E.index>=e.length)break;var L=E.index,O=E.index+E[0].length,C=A;for(C+=w.value.length;L>=C;)C+=(w=w.next).value.length;if(A=C-=w.value.length,w.value instanceof i)continue;for(var j=w;j!==n.tail&&(C<O||\"string\"==typeof j.value);j=j.next)S++,C+=j.value.length;S--,P=e.slice(A,C),E.index-=A}else if(!(E=l(b,0,P,m)))continue;L=E.index;var N=E[0],_=P.slice(0,L),M=P.slice(L+N.length),W=A+P.length;g&&W>g.reach&&(g.reach=W);var I=w.prev;if(_&&(I=u(n,I,_),A+=_.length),c(n,I,S),w=u(n,I,new i(f,p?a.tokenize(N,p):N,k,N)),M&&u(n,w,M),S>1){var T={cause:f+\",\"+d,reach:W};o(e,n,t,w.prev,A,T),g&&T.reach>g.reach&&(g.reach=T.reach)}}}}}}function s(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function u(e,n,t){var r=n.next,a={value:t,prev:n,next:r};return n.next=a,r.prev=a,e.length++,a}function c(e,n,t){for(var r=n.next,a=0;a<t&&r!==e.tail;a++)r=r.next;n.next=r,r.prev=n,e.length-=a}if(e.Prism=a,i.stringify=function e(n,t){if(\"string\"==typeof n)return n;if(Array.isArray(n)){var r=\"\";return n.forEach((function(n){r+=e(n,t)})),r}var i={type:n.type,content:e(n.content,t),tag:\"span\",classes:[\"token\",n.type],attributes:{},language:t},l=n.alias;l&&(Array.isArray(l)?Array.prototype.push.apply(i.classes,l):i.classes.push(l)),a.hooks.run(\"wrap\",i);var o=\"\";for(var s in i.attributes)o+=\" \"+s+'=\"'+(i.attributes[s]||\"\").replace(/\"/g,\"&quot;\")+'\"';return\"<\"+i.tag+' class=\"'+i.classes.join(\" \")+'\"'+o+\">\"+i.content+\"</\"+i.tag+\">\"},!e.document)return e.addEventListener?(a.disableWorkerMessageHandler||e.addEventListener(\"message\",(function(n){var t=JSON.parse(n.data),r=t.language,i=t.code,l=t.immediateClose;e.postMessage(a.highlight(i,a.languages[r],r)),l&&e.close()}),!1),a):a;var g=a.util.currentScript();function f(){a.manual||a.highlightAll()}if(g&&(a.filename=g.src,g.hasAttribute(\"data-manual\")&&(a.manual=!0)),!a.manual){var h=document.readyState;\"loading\"===h||\"interactive\"===h&&g&&g.defer?document.addEventListener(\"DOMContentLoaded\",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return a}(_self);\"undefined\"!=typeof module&&module.exports&&(module.exports=Prism),\"undefined\"!=typeof global&&(global.Prism=Prism);\nPrism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\\s\\S])*?-->/,greedy:!0},prolog:{pattern:/<\\?[\\s\\S]+?\\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>\"'[\\]]|\"[^\"]*\"|'[^']*')+(?:\\[(?:[^<\"'\\]]|\"[^\"]*\"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\\]\\s*)?>/i,greedy:!0,inside:{\"internal-subset\":{pattern:/(^[^\\[]*\\[)[\\s\\S]+(?=\\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/\"[^\"]*\"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\\]]/,\"doctype-tag\":/^DOCTYPE/i,name:/[^\\s<>'\"]+/}},cdata:{pattern:/<!\\[CDATA\\[[\\s\\S]*?\\]\\]>/i,greedy:!0},tag:{pattern:/<\\/?(?!\\d)[^\\s>\\/=$<%]+(?:\\s(?:\\s*[^\\s>\\/=]+(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))|(?=[\\s/>])))+)?\\s*\\/?>/,greedy:!0,inside:{tag:{pattern:/^<\\/?[^\\s>\\/]+/,inside:{punctuation:/^<\\/?/,namespace:/^[^\\s>\\/:]+:/}},\"special-attr\":[],\"attr-value\":{pattern:/=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:\"attr-equals\"},{pattern:/^(\\s*)[\"']|[\"']$/,lookbehind:!0}]}},punctuation:/\\/?>/,\"attr-name\":{pattern:/[^\\s>\\/]+/,inside:{namespace:/^[^\\s>\\/:]+:/}}}},entity:[{pattern:/&[\\da-z]{1,8};/i,alias:\"named-entity\"},/&#x?[\\da-f]{1,8};/i]},Prism.languages.markup.tag.inside[\"attr-value\"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside[\"internal-subset\"].inside=Prism.languages.markup,Prism.hooks.add(\"wrap\",(function(a){\"entity\"===a.type&&(a.attributes.title=a.content.replace(/&amp;/,\"&\"))})),Object.defineProperty(Prism.languages.markup.tag,\"addInlined\",{value:function(a,e){var s={};s[\"language-\"+e]={pattern:/(^<!\\[CDATA\\[)[\\s\\S]+?(?=\\]\\]>$)/i,lookbehind:!0,inside:Prism.languages[e]},s.cdata=/^<!\\[CDATA\\[|\\]\\]>$/i;var t={\"included-cdata\":{pattern:/<!\\[CDATA\\[[\\s\\S]*?\\]\\]>/i,inside:s}};t[\"language-\"+e]={pattern:/[\\s\\S]+/,inside:Prism.languages[e]};var n={};n[a]={pattern:RegExp(\"(<__[^>]*>)(?:<!\\\\[CDATA\\\\[(?:[^\\\\]]|\\\\](?!\\\\]>))*\\\\]\\\\]>|(?!<!\\\\[CDATA\\\\[)[^])*?(?=</__>)\".replace(/__/g,(function(){return a})),\"i\"),lookbehind:!0,greedy:!0,inside:t},Prism.languages.insertBefore(\"markup\",\"cdata\",n)}}),Object.defineProperty(Prism.languages.markup.tag,\"addAttribute\",{value:function(a,e){Prism.languages.markup.tag.inside[\"special-attr\"].push({pattern:RegExp(\"(^|[\\\"'\\\\s])(?:\"+a+\")\\\\s*=\\\\s*(?:\\\"[^\\\"]*\\\"|'[^']*'|[^\\\\s'\\\">=]+(?=[\\\\s>]))\",\"i\"),lookbehind:!0,inside:{\"attr-name\":/^[^\\s=]+/,\"attr-value\":{pattern:/=[\\s\\S]+/,inside:{value:{pattern:/(^=\\s*([\"']|(?![\"'])))\\S[\\s\\S]*(?=\\2$)/,lookbehind:!0,alias:[e,\"language-\"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:\"attr-equals\"},/\"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend(\"markup\",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml;\n!function(e){function n(e,n){return\"___\"+e.toUpperCase()+n+\"___\"}Object.defineProperties(e.languages[\"markup-templating\"]={},{buildPlaceholders:{value:function(t,a,r,o){if(t.language===a){var c=t.tokenStack=[];t.code=t.code.replace(r,(function(e){if(\"function\"==typeof o&&!o(e))return e;for(var r,i=c.length;-1!==t.code.indexOf(r=n(a,i));)++i;return c[i]=e,r})),t.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(t,a){if(t.language===a&&t.tokenStack){t.grammar=e.languages[a];var r=0,o=Object.keys(t.tokenStack);!function c(i){for(var u=0;u<i.length&&!(r>=o.length);u++){var g=i[u];if(\"string\"==typeof g||g.content&&\"string\"==typeof g.content){var l=o[r],s=t.tokenStack[l],f=\"string\"==typeof g?g:g.content,p=n(a,l),k=f.indexOf(p);if(k>-1){++r;var m=f.substring(0,k),d=new e.Token(a,e.tokenize(s,t.grammar),\"language-\"+a,s),h=f.substring(k+p.length),v=[];m&&v.push.apply(v,c([m])),v.push(d),h&&v.push.apply(v,c([h])),\"string\"==typeof g?i.splice.apply(i,[u,1].concat(v)):g.content=v}}else g.content&&c(g.content)}return i}(t.tokens)}}}})}(Prism);\n!function(e){var a=/\\/\\*[\\s\\S]*?\\*\\/|\\/\\/.*|#(?!\\[).*/,t=[{pattern:/\\b(?:false|true)\\b/i,alias:\"boolean\"},{pattern:/(::\\s*)\\b[a-z_]\\w*\\b(?!\\s*\\()/i,greedy:!0,lookbehind:!0},{pattern:/(\\b(?:case|const)\\s+)\\b[a-z_]\\w*(?=\\s*[;=])/i,greedy:!0,lookbehind:!0},/\\b(?:null)\\b/i,/\\b[A-Z_][A-Z0-9_]*\\b(?!\\s*\\()/],i=/\\b0b[01]+(?:_[01]+)*\\b|\\b0o[0-7]+(?:_[0-7]+)*\\b|\\b0x[\\da-f]+(?:_[\\da-f]+)*\\b|(?:\\b\\d+(?:_\\d+)*\\.?(?:\\d+(?:_\\d+)*)?|\\B\\.\\d+)(?:e[+-]?\\d+)?/i,n=/<?=>|\\?\\?=?|\\.{3}|\\??->|[!=]=?=?|::|\\*\\*=?|--|\\+\\+|&&|\\|\\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,s=/[{}\\[\\](),:;]/;e.languages.php={delimiter:{pattern:/\\?>$|^<\\?(?:php(?=\\s)|=)?/i,alias:\"important\"},comment:a,variable:/\\$+(?:\\w+\\b|(?=\\{))/,package:{pattern:/(namespace\\s+|use\\s+(?:function\\s+)?)(?:\\\\?\\b[a-z_]\\w*)+\\b(?!\\\\)/i,lookbehind:!0,inside:{punctuation:/\\\\/}},\"class-name-definition\":{pattern:/(\\b(?:class|enum|interface|trait)\\s+)\\b[a-z_]\\w*(?!\\\\)\\b/i,lookbehind:!0,alias:\"class-name\"},\"function-definition\":{pattern:/(\\bfunction\\s+)[a-z_]\\w*(?=\\s*\\()/i,lookbehind:!0,alias:\"function\"},keyword:[{pattern:/(\\(\\s*)\\b(?:array|bool|boolean|float|int|integer|object|string)\\b(?=\\s*\\))/i,alias:\"type-casting\",greedy:!0,lookbehind:!0},{pattern:/([(,?]\\s*)\\b(?:array(?!\\s*\\()|bool|callable|(?:false|null)(?=\\s*\\|)|float|int|iterable|mixed|object|self|static|string)\\b(?=\\s*\\$)/i,alias:\"type-hint\",greedy:!0,lookbehind:!0},{pattern:/(\\)\\s*:\\s*(?:\\?\\s*)?)\\b(?:array(?!\\s*\\()|bool|callable|(?:false|null)(?=\\s*\\|)|float|int|iterable|mixed|never|object|self|static|string|void)\\b/i,alias:\"return-type\",greedy:!0,lookbehind:!0},{pattern:/\\b(?:array(?!\\s*\\()|bool|float|int|iterable|mixed|object|string|void)\\b/i,alias:\"type-declaration\",greedy:!0},{pattern:/(\\|\\s*)(?:false|null)\\b|\\b(?:false|null)(?=\\s*\\|)/i,alias:\"type-declaration\",greedy:!0,lookbehind:!0},{pattern:/\\b(?:parent|self|static)(?=\\s*::)/i,alias:\"static-context\",greedy:!0},{pattern:/(\\byield\\s+)from\\b/i,lookbehind:!0},/\\bclass\\b/i,{pattern:/((?:^|[^\\s>:]|(?:^|[^-])>|(?:^|[^:]):)\\s*)\\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\\b/i,lookbehind:!0}],\"argument-name\":{pattern:/([(,]\\s*)\\b[a-z_]\\w*(?=\\s*:(?!:))/i,lookbehind:!0},\"class-name\":[{pattern:/(\\b(?:extends|implements|instanceof|new(?!\\s+self|\\s+static))\\s+|\\bcatch\\s*\\()\\b[a-z_]\\w*(?!\\\\)\\b/i,greedy:!0,lookbehind:!0},{pattern:/(\\|\\s*)\\b[a-z_]\\w*(?!\\\\)\\b/i,greedy:!0,lookbehind:!0},{pattern:/\\b[a-z_]\\w*(?!\\\\)\\b(?=\\s*\\|)/i,greedy:!0},{pattern:/(\\|\\s*)(?:\\\\?\\b[a-z_]\\w*)+\\b/i,alias:\"class-name-fully-qualified\",greedy:!0,lookbehind:!0,inside:{punctuation:/\\\\/}},{pattern:/(?:\\\\?\\b[a-z_]\\w*)+\\b(?=\\s*\\|)/i,alias:\"class-name-fully-qualified\",greedy:!0,inside:{punctuation:/\\\\/}},{pattern:/(\\b(?:extends|implements|instanceof|new(?!\\s+self\\b|\\s+static\\b))\\s+|\\bcatch\\s*\\()(?:\\\\?\\b[a-z_]\\w*)+\\b(?!\\\\)/i,alias:\"class-name-fully-qualified\",greedy:!0,lookbehind:!0,inside:{punctuation:/\\\\/}},{pattern:/\\b[a-z_]\\w*(?=\\s*\\$)/i,alias:\"type-declaration\",greedy:!0},{pattern:/(?:\\\\?\\b[a-z_]\\w*)+(?=\\s*\\$)/i,alias:[\"class-name-fully-qualified\",\"type-declaration\"],greedy:!0,inside:{punctuation:/\\\\/}},{pattern:/\\b[a-z_]\\w*(?=\\s*::)/i,alias:\"static-context\",greedy:!0},{pattern:/(?:\\\\?\\b[a-z_]\\w*)+(?=\\s*::)/i,alias:[\"class-name-fully-qualified\",\"static-context\"],greedy:!0,inside:{punctuation:/\\\\/}},{pattern:/([(,?]\\s*)[a-z_]\\w*(?=\\s*\\$)/i,alias:\"type-hint\",greedy:!0,lookbehind:!0},{pattern:/([(,?]\\s*)(?:\\\\?\\b[a-z_]\\w*)+(?=\\s*\\$)/i,alias:[\"class-name-fully-qualified\",\"type-hint\"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\\\/}},{pattern:/(\\)\\s*:\\s*(?:\\?\\s*)?)\\b[a-z_]\\w*(?!\\\\)\\b/i,alias:\"return-type\",greedy:!0,lookbehind:!0},{pattern:/(\\)\\s*:\\s*(?:\\?\\s*)?)(?:\\\\?\\b[a-z_]\\w*)+\\b(?!\\\\)/i,alias:[\"class-name-fully-qualified\",\"return-type\"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\\\/}}],constant:t,function:{pattern:/(^|[^\\\\\\w])\\\\?[a-z_](?:[\\w\\\\]*\\w)?(?=\\s*\\()/i,lookbehind:!0,inside:{punctuation:/\\\\/}},property:{pattern:/(->\\s*)\\w+/,lookbehind:!0},number:i,operator:n,punctuation:s};var l={pattern:/\\{\\$(?:\\{(?:\\{[^{}]+\\}|[^{}]+)\\}|[^{}])+\\}|(^|[^\\\\{])\\$+(?:\\w+(?:\\[[^\\r\\n\\[\\]]+\\]|->\\w+)?)/,lookbehind:!0,inside:e.languages.php},r=[{pattern:/<<<'([^']+)'[\\r\\n](?:.*[\\r\\n])*?\\1;/,alias:\"nowdoc-string\",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\\w*;$/i,alias:\"symbol\",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:\"([^\"]+)\"[\\r\\n](?:.*[\\r\\n])*?\\1;|([a-z_]\\w*)[\\r\\n](?:.*[\\r\\n])*?\\2;)/i,alias:\"heredoc-string\",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:\"[^\"]+\"|[a-z_]\\w*)|[a-z_]\\w*;$/i,alias:\"symbol\",inside:{punctuation:/^<<<\"?|[\";]$/}},interpolation:l}},{pattern:/`(?:\\\\[\\s\\S]|[^\\\\`])*`/,alias:\"backtick-quoted-string\",greedy:!0},{pattern:/'(?:\\\\[\\s\\S]|[^\\\\'])*'/,alias:\"single-quoted-string\",greedy:!0},{pattern:/\"(?:\\\\[\\s\\S]|[^\\\\\"])*\"/,alias:\"double-quoted-string\",greedy:!0,inside:{interpolation:l}}];e.languages.insertBefore(\"php\",\"variable\",{string:r,attribute:{pattern:/#\\[(?:[^\"'\\/#]|\\/(?![*/])|\\/\\/.*$|#(?!\\[).*$|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|\"(?:\\\\[\\s\\S]|[^\\\\\"])*\"|'(?:\\\\[\\s\\S]|[^\\\\'])*')+\\](?=\\s*[a-z$#])/im,greedy:!0,inside:{\"attribute-content\":{pattern:/^(#\\[)[\\s\\S]+(?=\\]$)/,lookbehind:!0,inside:{comment:a,string:r,\"attribute-class-name\":[{pattern:/([^:]|^)\\b[a-z_]\\w*(?!\\\\)\\b/i,alias:\"class-name\",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\\\?\\b[a-z_]\\w*)+/i,alias:[\"class-name\",\"class-name-fully-qualified\"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\\\/}}],constant:t,number:i,operator:n,punctuation:s}},delimiter:{pattern:/^#\\[|\\]$/,alias:\"punctuation\"}}}}),e.hooks.add(\"before-tokenize\",(function(a){/<\\?/.test(a.code)&&e.languages[\"markup-templating\"].buildPlaceholders(a,\"php\",/<\\?(?:[^\"'/#]|\\/(?![*/])|(\"|')(?:\\\\[\\s\\S]|(?!\\1)[^\\\\])*\\1|(?:\\/\\/|#(?!\\[))(?:[^?\\n\\r]|\\?(?!>))*(?=$|\\?>|[\\r\\n])|#\\[|\\/\\*(?:[^*]|\\*(?!\\/))*(?:\\*\\/|$))*?(?:\\?>|$)/g)})),e.hooks.add(\"after-tokenize\",(function(a){e.languages[\"markup-templating\"].tokenizePlaceholders(a,\"php\")}))}(Prism);\n!function(){if(\"undefined\"!=typeof Prism&&\"undefined\"!=typeof document&&document.querySelector){var e,t=\"line-numbers\",i=\"linkable-line-numbers\",n=/\\n(?!$)/g,r=!0;Prism.plugins.lineHighlight={highlightLines:function(o,u,c){var h=(u=\"string\"==typeof u?u:o.getAttribute(\"data-line\")||\"\").replace(/\\s+/g,\"\").split(\",\").filter(Boolean),d=+o.getAttribute(\"data-line-offset\")||0,f=(function(){if(void 0===e){var t=document.createElement(\"div\");t.style.fontSize=\"13px\",t.style.lineHeight=\"1.5\",t.style.padding=\"0\",t.style.border=\"0\",t.innerHTML=\"&nbsp;<br />&nbsp;\",document.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}return e}()?parseInt:parseFloat)(getComputedStyle(o).lineHeight),p=Prism.util.isActive(o,t),g=o.querySelector(\"code\"),m=p?o:g||o,v=[],y=g.textContent.match(n),b=y?y.length+1:1,A=g&&m!=g?function(e,t){var i=getComputedStyle(e),n=getComputedStyle(t);function r(e){return+e.substr(0,e.length-2)}return t.offsetTop+r(n.borderTopWidth)+r(n.paddingTop)-r(i.paddingTop)}(o,g):0;h.forEach((function(e){var t=e.split(\"-\"),i=+t[0],n=+t[1]||i;if(!((n=Math.min(b+d,n))<i)){var r=o.querySelector('.line-highlight[data-range=\"'+e+'\"]')||document.createElement(\"div\");if(v.push((function(){r.setAttribute(\"aria-hidden\",\"true\"),r.setAttribute(\"data-range\",e),r.className=(c||\"\")+\" line-highlight\"})),p&&Prism.plugins.lineNumbers){var s=Prism.plugins.lineNumbers.getLine(o,i),l=Prism.plugins.lineNumbers.getLine(o,n);if(s){var a=s.offsetTop+A+\"px\";v.push((function(){r.style.top=a}))}if(l){var u=l.offsetTop-s.offsetTop+l.offsetHeight+\"px\";v.push((function(){r.style.height=u}))}}else v.push((function(){r.setAttribute(\"data-start\",String(i)),n>i&&r.setAttribute(\"data-end\",String(n)),r.style.top=(i-d-1)*f+A+\"px\",r.textContent=new Array(n-i+2).join(\" \\n\")}));v.push((function(){r.style.width=o.scrollWidth+\"px\"})),v.push((function(){m.appendChild(r)}))}}));var P=o.id;if(p&&Prism.util.isActive(o,i)&&P){l(o,i)||v.push((function(){o.classList.add(i)}));var E=parseInt(o.getAttribute(\"data-start\")||\"1\");s(\".line-numbers-rows > span\",o).forEach((function(e,t){var i=t+E;e.onclick=function(){var e=P+\".\"+i;r=!1,location.hash=e,setTimeout((function(){r=!0}),1)}}))}return function(){v.forEach(a)}}};var o=0;Prism.hooks.add(\"before-sanity-check\",(function(e){var t=e.element.parentElement;if(u(t)){var i=0;s(\".line-highlight\",t).forEach((function(e){i+=e.textContent.length,e.parentNode.removeChild(e)})),i&&/^(?: \\n)+$/.test(e.code.slice(-i))&&(e.code=e.code.slice(0,-i))}})),Prism.hooks.add(\"complete\",(function e(i){var n=i.element.parentElement;if(u(n)){clearTimeout(o);var r=Prism.plugins.lineNumbers,s=i.plugins&&i.plugins.lineNumbers;l(n,t)&&r&&!s?Prism.hooks.add(\"line-numbers\",e):(Prism.plugins.lineHighlight.highlightLines(n)(),o=setTimeout(c,1))}})),window.addEventListener(\"hashchange\",c),window.addEventListener(\"resize\",(function(){s(\"pre\").filter(u).map((function(e){return Prism.plugins.lineHighlight.highlightLines(e)})).forEach(a)}))}function s(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function l(e,t){return e.classList.contains(t)}function a(e){e()}function u(e){return!!(e&&/pre/i.test(e.nodeName)&&(e.hasAttribute(\"data-line\")||e.id&&Prism.util.isActive(e,i)))}function c(){var e=location.hash.slice(1);s(\".temporary.line-highlight\").forEach((function(e){e.parentNode.removeChild(e)}));var t=(e.match(/\\.([\\d,-]+)$/)||[,\"\"])[1];if(t&&!document.getElementById(e)){var i=e.slice(0,e.lastIndexOf(\".\")),n=document.getElementById(i);n&&(n.hasAttribute(\"data-line\")||n.setAttribute(\"data-line\",\"\"),Prism.plugins.lineHighlight.highlightLines(n,t,\"temporary \")(),r&&document.querySelector(\".temporary.line-highlight\").scrollIntoView())}}}();\n!function(){if(\"undefined\"!=typeof Prism&&\"undefined\"!=typeof document){var e=\"line-numbers\",n=/\\n(?!$)/g,t=Prism.plugins.lineNumbers={getLine:function(n,t){if(\"PRE\"===n.tagName&&n.classList.contains(e)){var i=n.querySelector(\".line-numbers-rows\");if(i){var r=parseInt(n.getAttribute(\"data-start\"),10)||1,s=r+(i.children.length-1);t<r&&(t=r),t>s&&(t=s);var l=t-r;return i.children[l]}}},resize:function(e){r([e])},assumeViewportIndependence:!0},i=void 0;window.addEventListener(\"resize\",(function(){t.assumeViewportIndependence&&i===window.innerWidth||(i=window.innerWidth,r(Array.prototype.slice.call(document.querySelectorAll(\"pre.line-numbers\"))))})),Prism.hooks.add(\"complete\",(function(t){if(t.code){var i=t.element,s=i.parentNode;if(s&&/pre/i.test(s.nodeName)&&!i.querySelector(\".line-numbers-rows\")&&Prism.util.isActive(i,e)){i.classList.remove(e),s.classList.add(e);var l,o=t.code.match(n),a=o?o.length+1:1,u=new Array(a+1).join(\"<span></span>\");(l=document.createElement(\"span\")).setAttribute(\"aria-hidden\",\"true\"),l.className=\"line-numbers-rows\",l.innerHTML=u,s.hasAttribute(\"data-start\")&&(s.style.counterReset=\"linenumber \"+(parseInt(s.getAttribute(\"data-start\"),10)-1)),t.element.appendChild(l),r([s]),Prism.hooks.run(\"line-numbers\",t)}}})),Prism.hooks.add(\"line-numbers\",(function(e){e.plugins=e.plugins||{},e.plugins.lineNumbers=!0}))}function r(e){if(0!=(e=e.filter((function(e){var n,t=(n=e,n?window.getComputedStyle?getComputedStyle(n):n.currentStyle||null:null)[\"white-space\"];return\"pre-wrap\"===t||\"pre-line\"===t}))).length){var t=e.map((function(e){var t=e.querySelector(\"code\"),i=e.querySelector(\".line-numbers-rows\");if(t&&i){var r=e.querySelector(\".line-numbers-sizer\"),s=t.textContent.split(n);r||((r=document.createElement(\"span\")).className=\"line-numbers-sizer\",t.appendChild(r)),r.innerHTML=\"0\",r.style.display=\"block\";var l=r.getBoundingClientRect().height;return r.innerHTML=\"\",{element:e,lines:s,lineHeights:[],oneLinerHeight:l,sizer:r}}})).filter(Boolean);t.forEach((function(e){var n=e.sizer,t=e.lines,i=e.lineHeights,r=e.oneLinerHeight;i[t.length-1]=void 0,t.forEach((function(e,t){if(e&&e.length>1){var s=n.appendChild(document.createElement(\"span\"));s.style.display=\"block\",s.textContent=e}else i[t]=r}))})),t.forEach((function(e){for(var n=e.sizer,t=e.lineHeights,i=0,r=0;r<t.length;r++)void 0===t[r]&&(t[r]=n.children[i++].getBoundingClientRect().height)})),t.forEach((function(e){var n=e.sizer,t=e.element.querySelector(\".line-numbers-rows\");n.style.display=\"none\",n.innerHTML=\"\",e.lineHeights.forEach((function(e,n){t.children[n].style.height=e+\"px\"}))}))}}}();\n"
  },
  {
    "path": "src/Whoops/Resources/js/whoops.base.js",
    "content": "Zepto(function($) {\n  var $leftPanel      = $('.left-panel');\n  var $frameContainer = $('.frames-container');\n  var $appFramesTab   = $('#application-frames-tab');\n  var $allFramesTab   = $('#all-frames-tab');\n  var $container      = $('.details-container');\n  var $activeLine     = $frameContainer.find('.frame.active');\n  var $activeFrame    = $container.find('.frame-code.active');\n  var $ajaxEditors    = $('.editor-link[data-ajax]');\n  var $header         = $('header');\n\n  $header.on('mouseenter', function () {\n    if ($header.find('.exception').height() >= 145) {\n      $header.addClass('header-expand');\n    }\n  });\n  $header.on('mouseleave', function () {\n    $header.removeClass('header-expand');\n  });\n\n  /*\n   * add prettyprint classes to our current active codeblock\n   * run prettyPrint() to highlight the active code\n   * scroll to the line when prettyprint is done\n   * highlight the current line\n   */\n  var renderCurrentCodeblock = function(id) {\n    Prism.highlightAllUnder(document.querySelector('.frame-code-container .frame-code.active'));\n    highlightCurrentLine();\n  }\n\n  /*\n   * Highlight the active and neighboring lines for the current frame\n   * Adjust the offset to make sure that line is veritcally centered\n   */\n\n  var highlightCurrentLine = function() {\n    // We show more code than needed, purely for proper syntax highlighting\n    // Let’s hide a big chunk of that code and then scroll the remaining block\n    $activeFrame.find('.code-block').first().css({\n      maxHeight: 345,\n      overflow: 'hidden',\n    });\n\n    var line = $activeFrame.find('.code-block .line-highlight').first()[0];\n    // [internal] frames might not contain a code-block\n    if (line) {\n      line.scrollIntoView();\n      line.parentElement.scrollTop -= 180;\n    }\n\n    $container.scrollTop(0);\n  }\n\n  /*\n   * click handler for loading codeblocks\n   */\n\n  $frameContainer.on('click', '.frame', function() {\n\n    var $this  = $(this);\n    var id     = /frame\\-line\\-([\\d]*)/.exec($this.attr('id'))[1];\n    var $codeFrame = $('#frame-code-' + id);\n\n    if ($codeFrame) {\n\n      $activeLine.removeClass('active');\n      $activeFrame.removeClass('active');\n\n      $this.addClass('active');\n      $codeFrame.addClass('active');\n\n      $activeLine  = $this;\n      $activeFrame = $codeFrame;\n\n      renderCurrentCodeblock(id);\n\n    }\n\n  });\n\n  var clipboard = new ClipboardJS('.clipboard');\n  var showTooltip = function(elem, msg) {\n    elem.classList.add('tooltipped', 'tooltipped-s');\n    elem.setAttribute('aria-label', msg);\n  };\n\n  clipboard.on('success', function(e) {\n      e.clearSelection();\n\n      showTooltip(e.trigger, 'Copied!');\n  });\n\n  clipboard.on('error', function(e) {\n      showTooltip(e.trigger, fallbackMessage(e.action));\n  });\n\n  var btn = document.querySelector('.clipboard');\n\n  btn.addEventListener('mouseleave', function(e) {\n    e.currentTarget.classList.remove('tooltipped', 'tooltipped-s');\n    e.currentTarget.removeAttribute('aria-label');\n  });\n\n  function fallbackMessage(action) {\n    var actionMsg = '';\n    var actionKey = (action === 'cut' ? 'X' : 'C');\n\n    if (/Mac/i.test(navigator.userAgent)) {\n        actionMsg = 'Press ⌘-' + actionKey + ' to ' + action;\n    } else {\n        actionMsg = 'Press Ctrl-' + actionKey + ' to ' + action;\n    }\n\n    return actionMsg;\n  }\n\n  function scrollIntoView($node, $parent) {\n    var nodeOffset = $node.offset();\n    var nodeTop = nodeOffset.top;\n    var nodeBottom = nodeTop + nodeOffset.height;\n    var parentScrollTop = $parent.scrollTop();\n    var parentHeight = $parent.height();\n\n    if (nodeTop < 0) {\n      $parent.scrollTop(parentScrollTop + nodeTop);\n    } else if (nodeBottom > parentHeight) {\n      $parent.scrollTop(parentScrollTop + nodeBottom - parentHeight);\n    }\n  }\n\n  $(document).on('keydown', function(e) {\n    var applicationFrames = $frameContainer.hasClass('frames-container-application'),\n        frameClass = applicationFrames ? '.frame.frame-application' : '.frame';\n\n\t  if(e.ctrlKey || e.which === 74  || e.which === 75) {\n\t\t  // CTRL+Arrow-UP/k and Arrow-Down/j support:\n\t\t  // 1) select the next/prev element\n\t\t  // 2) make sure the newly selected element is within the view-scope\n\t\t  // 3) focus the (right) container, so arrow-up/down (without ctrl) scroll the details\n\t\t  if (e.which === 38 /* arrow up */ || e.which === 75 /* k */) {\n\t\t\t  $activeLine.prev(frameClass).click();\n\t\t\t  scrollIntoView($activeLine, $leftPanel);\n\t\t\t  $container.focus();\n\t\t\t  e.preventDefault();\n\t\t  } else if (e.which === 40 /* arrow down */ || e.which === 74 /* j */) {\n\t\t\t  $activeLine.next(frameClass).click();\n\t\t\t  scrollIntoView($activeLine, $leftPanel);\n\t\t\t  $container.focus();\n\t\t\t  e.preventDefault();\n\t\t  }\n\t  } else if (e.which == 78 /* n */) {\n      if ($appFramesTab.length) {\n        setActiveFramesTab($('.frames-tab:not(.frames-tab-active)'));\n      }\n    }\n  });\n\n  // Avoid to quit the page with some protocol (e.g. IntelliJ Platform REST API)\n  $ajaxEditors.on('click', function(e){\n    e.preventDefault();\n    $.get(this.href);\n  });\n\n  // Symfony VarDumper: Close the by default expanded objects\n  $('.sf-dump-expanded')\n    .removeClass('sf-dump-expanded')\n    .addClass('sf-dump-compact');\n  $('.sf-dump-toggle span').html('&#9654;');\n\n  // Make the given frames-tab active\n  function setActiveFramesTab($tab) {\n    $tab.addClass('frames-tab-active');\n\n    if ($tab.attr('id') == 'application-frames-tab') {\n      $frameContainer.addClass('frames-container-application');\n      $allFramesTab.removeClass('frames-tab-active');\n    } else {\n      $frameContainer.removeClass('frames-container-application');\n      $appFramesTab.removeClass('frames-tab-active');\n    }\n  }\n\n  $('a.frames-tab').on('click', function(e) {\n    e.preventDefault();\n    setActiveFramesTab($(this));\n  });\n\n    // Open editor from code block rows number\n  $(document).delegate('.line-numbers-rows > span', 'click', function(e) {\n    var linkTag = $(this).closest('.frame-code').find('.editor-link');\n    if (!linkTag) return;\n    var editorUrl = linkTag.attr('href');\n    var requiresAjax = linkTag.data('ajax');\n\n    var lineOffset = $(this).closest('[data-line-offset]').data('line-offset');\n    var lineNumber = lineOffset + $(this).index();\n\n    var realLine = $(this).closest('[data-line]').data('line');\n    if (!realLine) return;\n    var fileUrl = editorUrl.replace(\n      new RegExp('([:=])' + realLine),\n      '$1' + lineNumber\n    );\n\n    if (requiresAjax) {\n      $.get(fileUrl);\n    } else {\n      $('<a>').attr('href', fileUrl).trigger('click');\n    }\n  });\n\n  // Render late enough for highlightCurrentLine to be ready\n  renderCurrentCodeblock();\n});\n"
  },
  {
    "path": "src/Whoops/Resources/views/env_details.html.php",
    "content": "<?php /* List data-table values, i.e: $_SERVER, $_GET, .... */ ?>\n<div class=\"details\">\n  <h2 class=\"details-heading\">Environment &amp; details:</h2>\n\n  <div class=\"data-table-container\" id=\"data-tables\">\n    <?php foreach ($tables as $label => $data): ?>\n      <div class=\"data-table\" id=\"sg-<?php echo $tpl->escape($tpl->slug($label)) ?>\">\n        <?php if (!empty($data)): ?>\n            <label><?php echo $tpl->escape($label) ?></label>\n            <table class=\"data-table\">\n              <thead>\n                <tr>\n                  <td class=\"data-table-k\">Key</td>\n                  <td class=\"data-table-v\">Value</td>\n                </tr>\n              </thead>\n            <?php foreach ($data as $k => $value): ?>\n              <tr>\n                <td><?php echo $tpl->escape($k) ?></td>\n                <td><?php echo $tpl->dump($value) ?></td>\n              </tr>\n            <?php endforeach ?>\n            </table>\n        <?php else: ?>\n            <label class=\"empty\"><?php echo $tpl->escape($label) ?></label>\n            <span class=\"empty\">empty</span>\n        <?php endif ?>\n      </div>\n    <?php endforeach ?>\n  </div>\n\n  <?php /* List registered handlers, in order of first to last registered */ ?>\n  <div class=\"data-table-container\" id=\"handlers\">\n    <label>Registered Handlers</label>\n    <?php foreach ($handlers as $i => $h): ?>\n      <div class=\"handler <?php echo ($h === $handler) ? 'active' : ''?>\">\n        <?php echo $i ?>. <?php echo $tpl->escape(get_class($h)) ?>\n      </div>\n    <?php endforeach ?>\n  </div>\n\n</div>\n"
  },
  {
    "path": "src/Whoops/Resources/views/frame_code.html.php",
    "content": "<?php /* Display a code block for all frames in the stack.\n       * @todo: This should PROBABLY be done on-demand, lest\n       * we get 200 frames to process. */ ?>\n<div class=\"frame-code-container <?php echo (!$has_frames ? 'empty' : '') ?>\">\n  <?php foreach ($frames as $i => $frame): ?>\n    <?php $line = $frame->getLine(); ?>\n      <div class=\"frame-code <?php echo ($i == 0 ) ? 'active' : '' ?>\" id=\"frame-code-<?php echo $i ?>\">\n        <div class=\"frame-file\">\n          <?php $filePath = $frame->getFile(); ?>\n          <?php if ($filePath && $editorHref = $handler->getEditorHref($filePath, (int) $line)): ?>\n            <a href=\"<?php echo $editorHref ?>\" class=\"editor-link\"<?php echo ($handler->getEditorAjax($filePath, (int) $line) ? ' data-ajax' : '') ?>>\n              Open:\n              <strong><?php echo $tpl->breakOnDelimiter('/', $tpl->escape($filePath ?: '<#unknown>')) ?></strong>\n            </a>\n          <?php else: ?>\n            <strong><?php echo $tpl->breakOnDelimiter('/', $tpl->escape($filePath ?: '<#unknown>')) ?></strong>\n          <?php endif ?>\n        </div>\n        <?php\n          // Do nothing if there's no line to work off\n          if ($line !== null):\n\n          // the $line is 1-indexed, we nab -1 where needed to account for this\n          $range = $frame->getFileLines($line - 20, 40);\n\n          // getFileLines can return null if there is no source code\n          if ($range):\n            $range = array_map(function ($line) { return empty($line) ? ' ' : $line;}, $range);\n            $start = key($range) + 1;\n            $code  = join(\"\\n\", $range);\n        ?>\n            <pre class=\"code-block line-numbers\"\n              data-line=\"<?php echo $line ?>\"\n              data-line-offset=\"<?php echo $start ?>\"\n              data-start=\"<?php echo $start ?>\"\n            ><code class=\"language-php\"><?php echo $tpl->escape($code) ?></code></pre>\n\n          <?php endif ?>\n        <?php endif ?>\n\n        <?php $frameArgs = $tpl->dumpArgs($frame); ?>\n        <?php if ($frameArgs): ?>\n          <div class=\"frame-file\">\n              Arguments\n          </div>\n          <div id=\"frame-code-args-<?=$i?>\" class=\"code-block frame-args\">\n              <?php echo $frameArgs; ?>\n          </div>\n        <?php endif ?>\n\n        <?php\n          // Append comments for this frame\n          $comments = $frame->getComments();\n        ?>\n        <div class=\"frame-comments <?php echo empty($comments) ? 'empty' : '' ?>\">\n          <?php foreach ($comments as $commentNo => $comment): ?>\n            <?php extract($comment) ?>\n            <div class=\"frame-comment\" id=\"comment-<?php echo $i . '-' . $commentNo ?>\">\n              <span class=\"frame-comment-context\"><?php echo $tpl->escape($context) ?></span>\n              <?php echo $tpl->escapeButPreserveUris($comment) ?>\n            </div>\n          <?php endforeach ?>\n        </div>\n\n      </div>\n  <?php endforeach ?>\n</div>\n"
  },
  {
    "path": "src/Whoops/Resources/views/frame_list.html.php",
    "content": "<?php /* List file names & line numbers for all stack frames;\n         clicking these links/buttons will display the code view\n         for that particular frame */ ?>\n<?php foreach ($frames as $i => $frame): ?>\n  <div class=\"frame <?php echo ($i == 0 ? 'active' : '') ?> <?php echo ($frame->isApplication() ? 'frame-application' : '') ?>\" id=\"frame-line-<?php echo $i ?>\">\n      <span class=\"frame-index\"><?php echo (count($frames) - $i - 1) ?></span>\n      <div class=\"frame-method-info\">\n        <span class=\"frame-class\"><?php echo $tpl->breakOnDelimiter('\\\\', $tpl->escape($frame->getClass() ?: '')) ?></span>\n        <span class=\"frame-function\"><?php echo $tpl->breakOnDelimiter('\\\\', $tpl->escape($frame->getFunction() ?: '')) ?></span>\n      </div>\n\n    <div class=\"frame-file\">\n        <?php echo $frame->getFile() ? $tpl->breakOnDelimiter('/', $tpl->shorten($tpl->escape($frame->getFile()))) : '<#unknown>' ?><!--\n   --><span class=\"frame-line\">:<?php echo (int) $frame->getLine() ?></span>\n    </div>\n  </div>\n<?php endforeach;\n"
  },
  {
    "path": "src/Whoops/Resources/views/frames_container.html.php",
    "content": "<div class=\"frames-container <?php echo $active_frames_tab == 'application' ? 'frames-container-application' : '' ?>\">\n  <?php $tpl->render($frame_list) ?>\n</div>"
  },
  {
    "path": "src/Whoops/Resources/views/frames_description.html.php",
    "content": "<div class=\"frames-description <?php echo $has_frames_tabs ? 'frames-description-application' : '' ?>\">\n  <?php if ($has_frames_tabs): ?>\n    <a href=\"#\" id=\"application-frames-tab\" class=\"frames-tab <?php echo $active_frames_tab == 'application' ? 'frames-tab-active' : '' ?>\">\n        Application frames (<?php echo $frames->countIsApplication() ?>)\n    </a>\n    <a href=\"#\" id=\"all-frames-tab\" class=\"frames-tab <?php echo $active_frames_tab == 'all' ? 'frames-tab-active' : '' ?>\">\n      All frames (<?php echo count($frames) ?>)\n    </a>\n  <?php else: ?>\n    <span>\n        Stack frames (<?php echo count($frames) ?>)\n    </span>\n  <?php endif; ?>\n</div>\n"
  },
  {
    "path": "src/Whoops/Resources/views/header.html.php",
    "content": "<div class=\"exception\">\n  <div class=\"exc-title\">\n    <?php foreach ($name as $i => $nameSection): ?>\n      <?php if ($i == count($name) - 1): ?>\n        <span class=\"exc-title-primary\"><?php echo $tpl->escape($nameSection) ?></span>\n      <?php else: ?>\n        <?php echo $tpl->escape($nameSection) . ' \\\\' ?>\n      <?php endif ?>\n    <?php endforeach ?>\n    <?php if ($code): ?>\n      <span title=\"Exception Code\">(<?php echo $tpl->escape($code) ?>)</span>\n    <?php endif ?>\n  </div>\n\n  <div class=\"exc-message\">\n    <?php if (!empty($message)): ?>\n      <span><?php echo $tpl->escape($message) ?></span>\n\n\n      <?php if (count($previousMessages)): ?>\n        <div class=\"exc-title prev-exc-title\">\n          <span class=\"exc-title-secondary\">Previous exceptions</span>\n        </div>\n\n        <ul>\n          <?php foreach ($previousMessages as $i => $previousMessage): ?>\n            <li>\n              <?php echo $tpl->escape($previousMessage) ?>\n              <span class=\"prev-exc-code\">(<?php echo $previousCodes[$i] ?>)</span>\n            </li>\n          <?php endforeach; ?>\n        </ul>\n      <?php endif ?>\n\n\n\n    <?php else: ?>\n      <span class=\"exc-message-empty-notice\">No message</span>\n    <?php endif ?>\n\n    <ul class=\"search-for-help\">\n      <?php if (!empty($docref_url)): ?>\n      <li>\n        <a rel=\"noopener noreferrer\" target=\"_blank\" href=\"<?php echo $docref_url; ?>\" title=\"Search for help in the PHP manual.\">\n          <!-- PHP icon by Icons Solid -->\n          <!-- https://www.iconfinder.com/icons/322421/book_icon -->\n          <!-- Free for commercial use -->\n          <svg height=\"16px\" id=\"Layer_1\" style=\"enable-background:new 0 0 32 32;\" version=\"1.1\" viewBox=\"0 0 32 32\" width=\"16px\" xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><g transform=\"translate(240 0)\"><path d=\"M-211,4v26h-24c-1.104,0-2-0.895-2-2s0.896-2,2-2h22V0h-22c-2.209,0-4,1.791-4,4v24c0,2.209,1.791,4,4,4h26V4H-211z    M-235,8V2h20v22h-20V8z M-219,6h-12V4h12V6z M-223,10h-8V8h8V10z M-227,14h-4v-2h4V14z\"/></g></svg>\n        </a>\n      </li>\n      <?php endif ?>\n      <li>\n        <a rel=\"noopener noreferrer\" target=\"_blank\" href=\"https://google.com/search?q=<?php echo urlencode(implode('\\\\', $name).' '.$message) ?>\" title=\"Search for help on Google.\">\n          <!-- Google icon by Alfredo H, from https://www.iconfinder.com/alfredoh -->\n          <!-- Creative Commons (Attribution 3.0 Unported) -->\n          <!-- http://creativecommons.org/licenses/by/3.0/ -->\n          <svg class=\"google\" height=\"16\" viewBox=\"0 0 512 512\" width=\"16\" xmlns=\"http://www.w3.org/2000/svg\">\n            <path d=\"M457.732 216.625c2.628 14.04 4.063 28.743 4.063 44.098C461.795 380.688 381.48 466 260.205 466c-116.024 0-210-93.977-210-210s93.976-210 210-210c56.703 0 104.076 20.867 140.44 54.73l-59.205 59.197v-.135c-22.046-21.002-50-31.762-81.236-31.762-69.297 0-125.604 58.537-125.604 127.84 0 69.29 56.306 127.97 125.604 127.97 62.87 0 105.653-35.966 114.46-85.313h-114.46v-81.902h197.528z\"/>\n          </svg>\n        </a>\n      </li>\n      <li>\n        <a rel=\"noopener noreferrer\" target=\"_blank\" href=\"https://duckduckgo.com/?q=<?php echo urlencode(implode('\\\\', $name).' '.$message) ?>\" title=\"Search for help on DuckDuckGo.\">\n          <!-- DuckDuckGo icon by IconBaandar Team, from https://www.iconfinder.com/iconbaandar -->\n          <!-- Creative Commons (Attribution 3.0 Unported) -->\n          <!-- http://creativecommons.org/licenses/by/3.0/ -->\n          <svg class=\"duckduckgo\" height=\"16\" viewBox=\"150 150 1675 1675\" width=\"16\" xmlns=\"http://www.w3.org/2000/svg\">\n            <path d=\"M1792 1024c0 204.364-80.472 398.56-224.955 543.04-144.483 144.48-338.68 224.95-543.044 224.95-204.36 0-398.56-80.47-543.04-224.95-144.48-144.482-224.95-338.676-224.95-543.04 0-204.365 80.47-398.562 224.96-543.045C625.44 336.47 819.64 256 1024 256c204.367 0 398.565 80.47 543.05 224.954C1711.532 625.437 1792 819.634 1792 1024zm-270.206 497.787C1654.256 1389.327 1728 1211.36 1728 1024c0-187.363-73.74-365.332-206.203-497.796C1389.332 393.74 1211.363 320 1024 320s-365.33 73.742-497.795 206.205C393.742 658.67 320 836.637 320 1024c0 187.36 73.744 365.326 206.206 497.787C658.67 1654.25 836.638 1727.99 1024 1727.99c187.362 0 365.33-73.74 497.794-206.203z\"/>\n            <path d=\"M1438.64 1177.41c0-.03-.005-.017-.01.004l.01-.004z\"/>\n            <path d=\"M1499.8 976.878c.03-.156-.024-.048-.11.107l.11-.107z\"/>\n            <path d=\"M1105.19 991.642zm-68.013-376.128c-8.087-10.14-18.028-19.965-29.89-29.408-13.29-10.582-29-20.76-47.223-30.443-35.07-18.624-74.482-31.61-115.265-38.046-39.78-6.28-80.84-6.256-120.39.917l1.37 31.562c1.8.164 7.7 3.9 14.36 8.32-20.68 5.94-39.77 14.447-39.48 39.683l.2 17.48 17.3-1.73c29.38-2.95 60.17-2.06 90.32 2.61 9.21 1.42 18.36 3.2 27.38 5.32l-4.33 1.15c-20.45 5.58-38.93 12.52-54.25 20.61-46.28 24.32-75.51 60.85-90.14 108.37-14.14 45.95-14.27 101.81-2.72 166.51l.06.06c15.14 84.57 64.16 316.39 104.11 505.39 19.78 93.59 37.38 176.83 47.14 224.4 3.26 15.84 5.03 31.02 5.52 45.52.3 9.08.09 17.96-.58 26.62-.45 5.8-1.11 11.51-1.96 17.112l31.62 4.75c.71-4.705 1.3-9.494 1.76-14.373 48.964 10.517 99.78 16.05 151.88 16.05 60.68 0 119.61-7.505 175.91-21.64 3.04 6.08 6.08 12.19 9.11 18.32l28.62-14.128c-2.11-4.27-4.235-8.55-6.37-12.84-23.005-46.124-47.498-93.01-68.67-133.534-15.39-29.466-29.01-55.53-39.046-75.58-26.826-53.618-53.637-119.47-68.28-182.368-8.78-37.705-13.128-74.098-10.308-105.627-15.31-6.28-26.69-11.8-31.968-15.59l-.01.015c-14.22-10.2-31.11-28.12-41.82-49.717-8.618-17.376-13.4-37.246-10.147-57.84 3.17-19.84 27.334-46.714 57.843-67.46v-.063c26.554-18.05 58.75-32.506 86.32-34.31 7.835-.51 16.31-1.008 23.99-1.45 33.45-1.95 50.243-2.93 84.475-11.42 10.88-2.697 26.19-6.56 43.53-11.09 2.364-40.7-5.947-87.596-21.04-133.234-22.004-66.53-58.68-131.25-97.627-170.21-12.543-12.55-28.17-22.79-45.9-30.933-16.88-7.753-35.64-13.615-55.436-17.782zm-10.658 178.553s6.77-42.485 58.39-33.977c27.96 4.654 37.89 29.833 37.89 29.833s-25.31-14.46-44.95-14.198c-40.33.53-51.35 18.342-51.35 18.342zm-240.45-18.802c48.49-19.853 72.11 11.298 72.11 11.298s-35.21-15.928-69.46 5.59c-34.19 21.477-32.92 43.452-32.92 43.452s-18.17-40.5 30.26-60.34zm296.5 95.4c0-6.677 2.68-12.694 7.01-17.02 4.37-4.37 10.42-7.074 17.1-7.074 6.73 0 12.79 2.7 17.15 7.05 4.33 4.33 7.01 10.36 7.01 17.05 0 6.74-2.7 12.81-7.07 17.18-4.33 4.33-10.37 7.01-17.1 7.01-6.68 0-12.72-2.69-17.05-7.03-4.36-4.37-7.07-10.43-7.07-17.16zm-268.42 51.27c0-8.535 3.41-16.22 8.93-21.738 5.55-5.55 13.25-8.982 21.81-8.982 8.51 0 16.18 3.415 21.7 8.934 5.55 5.55 8.98 13.25 8.98 21.78 0 8.53-3.44 16.23-8.98 21.79-5.52 5.52-13.19 8.93-21.71 8.93-8.55 0-16.26-3.43-21.82-8.99-5.52-5.52-8.93-13.2-8.93-21.74z\"/>\n            <path d=\"M1102.48 986.34zm390.074-64.347c-28.917-11.34-74.89-12.68-93.32-3.778-11.5 5.567-35.743 13.483-63.565 21.707-25.75 7.606-53.9 15.296-78.15 21.702-17.69 4.67-33.3 8.66-44.4 11.435-34.92 8.76-52.05 9.77-86.17 11.78-7.84.46-16.48.97-24.48 1.5-28.12 1.86-60.97 16.77-88.05 35.4v.06c-31.12 21.4-55.77 49.12-59.01 69.59-3.32 21.24 1.56 41.74 10.35 59.67 10.92 22.28 28.15 40.77 42.66 51.29l.01-.02c5.38 3.9 16.98 9.6 32.6 16.08 26.03 10.79 63.2 23.76 101.25 34.23 43.6 11.99 89.11 21.05 121.69 20.41 34.26-.69 77.73-10.52 114.54-24.67 22.15-8.52 42.21-18.71 56.88-29.58 17.85-13.22 28.7-28.42 28.4-44.74-.07-3.89-.72-7.63-1.97-11.21l-.02.01c-11.6-33.06-50.37-23.59-105.53-10.12-46.86 11.445-107.94 26.365-169.01 20.434-32.56-3.167-54.45-10.61-67.88-20.133-5.96-4.224-9.93-8.67-12.18-13.11-1.96-3.865-2.68-7.84-2.33-11.714.39-4.42 2.17-9.048 5.1-13.57l-.05-.03c7.86-12.118 23.082-9.72 43.93-6.43 25.91 4.08 58.2 9.172 99.013-3.61 39.63-12.378 87.76-29.9 131.184-47.39 42.405-17.08 80.08-34.078 100.74-46.18 25.46-14.87 37.57-29.428 40.59-42.866 2.725-12.152-.89-22.48-8.903-31.07-5.87-6.29-14.254-11.31-23.956-15.115z\"/>\n          </svg>\n        </a>\n      </li>\n      <li>\n        <a rel=\"noopener noreferrer\" target=\"_blank\" href=\"https://stackoverflow.com/search?q=<?php echo urlencode(implode('\\\\', $name).' '.$message) ?>\" title=\"Search for help on Stack Overflow.\">\n          <!-- Stack Overflow icon by Picons.me, from https://www.iconfinder.com/Picons -->\n          <!-- Free for commercial use -->\n          <svg class=\"stackoverflow\" height=\"16\" viewBox=\"-1163 1657.697 56.693 56.693\" width=\"16\" xmlns=\"http://www.w3.org/2000/svg\">\n            <path d=\"M-1126.04 1689.533l-16.577-9.778 2.088-3.54 16.578 9.778zM-1127.386 1694.635l-18.586-4.996 1.068-3.97 18.586 4.995zM-1127.824 1700.137l-19.165-1.767.378-4.093 19.165 1.767zM-1147.263 1701.293h19.247v4.11h-19.247z\"/>\n            <path d=\"M-1121.458 1710.947s0 .96-.032.96v.016h-30.796s-.96 0-.96-.016h-.032v-20.03h3.288v16.805h25.244v-16.804h3.288v19.07zM-1130.667 1667.04l10.844 15.903-3.396 2.316-10.843-15.903zM-1118.313 1663.044l3.29 18.963-4.05.703-3.29-18.963z\"/>\n          </svg>\n        </a>\n      </li>\n    </ul>\n\n    <span id=\"plain-exception\"><?php echo $tpl->escape($plain_exception) ?></span>\n    <button id=\"copy-button\" class=\"rightButton clipboard\" data-clipboard-text=\"<?php echo $tpl->escape($plain_exception) ?>\" title=\"Copy exception details to clipboard\">\n      COPY\n    </button>\n    <button id=\"hide-error\" class=\"rightButton\" title=\"Hide error message\" onclick=\"document.getElementsByClassName('Whoops')[0].style.display = 'none';\">\n      HIDE\n    </button>\n  </div>\n</div>\n"
  },
  {
    "path": "src/Whoops/Resources/views/header_outer.html.php",
    "content": "<header>\n  <?php $tpl->render($header) ?>\n</header>\n"
  },
  {
    "path": "src/Whoops/Resources/views/layout.html.php",
    "content": "<?php\n/**\n* Layout template file for Whoops's pretty error output.\n*/\n?>\n<!DOCTYPE html><?php echo $preface; ?>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"robots\" content=\"noindex,nofollow\"/>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\"/>\n    <title><?php echo $tpl->escape($page_title) ?></title>\n\n    <style><?php echo $stylesheet ?></style>\n    <style><?php echo $prismCss ?></style>\n  </head>\n  <body>\n\n    <div class=\"Whoops container\">\n      <div class=\"stack-container\">\n\n        <?php $tpl->render($panel_left_outer) ?>\n\n        <?php $tpl->render($panel_details_outer) ?>\n\n      </div>\n    </div>\n\n    <script data-manual><?php echo $prismJs ?></script>\n    <script><?php echo $zepto ?></script>\n    <script><?php echo $clipboard ?></script>\n    <script><?php echo $javascript ?></script>\n  </body>\n</html>\n"
  },
  {
    "path": "src/Whoops/Resources/views/panel_details.html.php",
    "content": "<?php $tpl->render($frame_code) ?>\n<?php $tpl->render($env_details) ?>"
  },
  {
    "path": "src/Whoops/Resources/views/panel_details_outer.html.php",
    "content": "<div class=\"panel details-container cf\">\n  <?php $tpl->render($panel_details) ?>\n</div>"
  },
  {
    "path": "src/Whoops/Resources/views/panel_left.html.php",
    "content": "<?php \n$tpl->render($header_outer);\n$tpl->render($frames_description);\n$tpl->render($frames_container);\n"
  },
  {
    "path": "src/Whoops/Resources/views/panel_left_outer.html.php",
    "content": "<div class=\"panel left-panel cf <?php echo (!$has_frames ? 'empty' : '') ?>\">\n  <?php $tpl->render($panel_left) ?>\n</div>"
  },
  {
    "path": "src/Whoops/Run.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops;\n\nuse InvalidArgumentException;\nuse Throwable;\nuse Whoops\\Exception\\ErrorException;\nuse Whoops\\Handler\\CallbackHandler;\nuse Whoops\\Handler\\Handler;\nuse Whoops\\Handler\\HandlerInterface;\nuse Whoops\\Inspector\\CallableInspectorFactory;\nuse Whoops\\Inspector\\InspectorFactory;\nuse Whoops\\Inspector\\InspectorFactoryInterface;\nuse Whoops\\Inspector\\InspectorInterface;\nuse Whoops\\Util\\Misc;\nuse Whoops\\Util\\SystemFacade;\n\nfinal class Run implements RunInterface\n{\n    /**\n     * @var bool\n     */\n    private $isRegistered;\n\n    /**\n     * @var bool\n     */\n    private $allowQuit       = true;\n\n    /**\n     * @var bool\n     */\n    private $sendOutput      = true;\n\n    /**\n     * @var integer|false\n     */\n    private $sendHttpCode    = 500;\n\n    /**\n     * @var integer|false\n     */\n    private $sendExitCode    = 1;\n\n    /**\n     * @var HandlerInterface[]\n     */\n    private $handlerStack = [];\n\n    /**\n     * @var array\n     * @psalm-var list<array{patterns: string, levels: int}>\n     */\n    private $silencedPatterns = [];\n\n    /**\n     * @var SystemFacade\n     */\n    private $system;\n\n    /**\n     * In certain scenarios, like in shutdown handler, we can not throw exceptions.\n     *\n     * @var bool\n     */\n    private $canThrowExceptions = true;\n\n    /**\n     * The inspector factory to create inspectors.\n     *\n     * @var InspectorFactoryInterface\n     */\n    private $inspectorFactory;\n\n    /**\n     * @var array<callable>\n     */\n    private $frameFilters = [];\n\n    public function __construct(?SystemFacade $system = null)\n    {\n        $this->system = $system ?: new SystemFacade;\n        $this->inspectorFactory = new InspectorFactory();\n    }\n\n    public function __destruct()\n    {\n        $this->unregister();\n    }\n\n    /**\n     * Explicitly request your handler runs as the last of all currently registered handlers.\n     *\n     * @param callable|HandlerInterface $handler\n     *\n     * @return Run\n     */\n    public function appendHandler($handler)\n    {\n        array_unshift($this->handlerStack, $this->resolveHandler($handler));\n        return $this;\n    }\n\n    /**\n     * Explicitly request your handler runs as the first of all currently registered handlers.\n     *\n     * @param callable|HandlerInterface $handler\n     *\n     * @return Run\n     */\n    public function prependHandler($handler)\n    {\n        return $this->pushHandler($handler);\n    }\n\n    /**\n     * Register your handler as the last of all currently registered handlers (to be executed first).\n     * Prefer using appendHandler and prependHandler for clarity.\n     *\n     * @param callable|HandlerInterface $handler\n     *\n     * @return Run\n     *\n     * @throws InvalidArgumentException If argument is not callable or instance of HandlerInterface.\n     */\n    public function pushHandler($handler)\n    {\n        $this->handlerStack[] = $this->resolveHandler($handler);\n        return $this;\n    }\n\n    /**\n     * Removes and returns the last handler pushed to the handler stack.\n     *\n     * @see Run::removeFirstHandler(), Run::removeLastHandler()\n     *\n     * @return HandlerInterface|null\n     */\n    public function popHandler()\n    {\n        return array_pop($this->handlerStack);\n    }\n\n    /**\n     * Removes the first handler.\n     *\n     * @return void\n     */\n    public function removeFirstHandler()\n    {\n        array_pop($this->handlerStack);\n    }\n\n    /**\n     * Removes the last handler.\n     *\n     * @return void\n     */\n    public function removeLastHandler()\n    {\n        array_shift($this->handlerStack);\n    }\n\n    /**\n     * Returns an array with all handlers, in the order they were added to the stack.\n     *\n     * @return array\n     */\n    public function getHandlers()\n    {\n        return $this->handlerStack;\n    }\n\n    /**\n     * Clears all handlers in the handlerStack, including the default PrettyPage handler.\n     *\n     * @return Run\n     */\n    public function clearHandlers()\n    {\n        $this->handlerStack = [];\n        return $this;\n    }\n\n    public function getFrameFilters()\n    {\n        return $this->frameFilters;\n    }\n\n    public function clearFrameFilters()\n    {\n        $this->frameFilters = [];\n        return $this;\n    }\n\n    /**\n     * Registers this instance as an error handler.\n     *\n     * @return Run\n     */\n    public function register()\n    {\n        if (!$this->isRegistered) {\n            // Workaround PHP bug 42098\n            // https://bugs.php.net/bug.php?id=42098\n            class_exists(\"\\\\Whoops\\\\Exception\\\\ErrorException\");\n            class_exists(\"\\\\Whoops\\\\Exception\\\\FrameCollection\");\n            class_exists(\"\\\\Whoops\\\\Exception\\\\Frame\");\n            class_exists(\"\\\\Whoops\\\\Exception\\\\Inspector\");\n            class_exists(\"\\\\Whoops\\\\Inspector\\\\InspectorFactory\");\n\n            $this->system->setErrorHandler([$this, self::ERROR_HANDLER]);\n            $this->system->setExceptionHandler([$this, self::EXCEPTION_HANDLER]);\n            $this->system->registerShutdownFunction([$this, self::SHUTDOWN_HANDLER]);\n\n            $this->isRegistered = true;\n        }\n\n        return $this;\n    }\n\n    /**\n     * Unregisters all handlers registered by this Whoops\\Run instance.\n     *\n     * @return Run\n     */\n    public function unregister()\n    {\n        if ($this->isRegistered) {\n            $this->system->restoreExceptionHandler();\n            $this->system->restoreErrorHandler();\n\n            $this->isRegistered = false;\n        }\n\n        return $this;\n    }\n\n    /**\n     * Should Whoops allow Handlers to force the script to quit?\n     *\n     * @param bool|int $exit\n     *\n     * @return bool\n     */\n    public function allowQuit($exit = null)\n    {\n        if (func_num_args() == 0) {\n            return $this->allowQuit;\n        }\n\n        return $this->allowQuit = (bool) $exit;\n    }\n\n    /**\n     * Silence particular errors in particular files.\n     *\n     * @param array|string $patterns List or a single regex pattern to match.\n     * @param int          $levels   Defaults to E_STRICT | E_DEPRECATED.\n     *\n     * @return Run\n     */\n    public function silenceErrorsInPaths($patterns, $levels = 10240)\n    {\n        $this->silencedPatterns = array_merge(\n            $this->silencedPatterns,\n            array_map(\n                function ($pattern) use ($levels) {\n                    return [\n                        \"pattern\" => $pattern,\n                        \"levels\" => $levels,\n                    ];\n                },\n                (array) $patterns\n            )\n        );\n\n        return $this;\n    }\n\n    /**\n     * Returns an array with silent errors in path configuration.\n     *\n     * @return array\n     */\n    public function getSilenceErrorsInPaths()\n    {\n        return $this->silencedPatterns;\n    }\n\n    /**\n     * Should Whoops send HTTP error code to the browser if possible?\n     * Whoops will by default send HTTP code 500, but you may wish to\n     * use 502, 503, or another 5xx family code.\n     *\n     * @param bool|int $code\n     *\n     * @return int|false\n     *\n     * @throws InvalidArgumentException\n     */\n    public function sendHttpCode($code = null)\n    {\n        if (func_num_args() == 0) {\n            return $this->sendHttpCode;\n        }\n\n        if (!$code) {\n            return $this->sendHttpCode = false;\n        }\n\n        if ($code === true) {\n            $code = 500;\n        }\n\n        if ($code < 400 || 600 <= $code) {\n            throw new InvalidArgumentException(\n                \"Invalid status code '$code', must be 4xx or 5xx\"\n            );\n        }\n\n        return $this->sendHttpCode = $code;\n    }\n\n    /**\n     * Should Whoops exit with a specific code on the CLI if possible?\n     * Whoops will exit with 1 by default, but you can specify something else.\n     *\n     * @param int $code\n     *\n     * @return int\n     *\n     * @throws InvalidArgumentException\n     */\n    public function sendExitCode($code = null)\n    {\n        if (func_num_args() == 0) {\n            return $this->sendExitCode;\n        }\n\n        if ($code < 0 || 255 <= $code) {\n            throw new InvalidArgumentException(\n                \"Invalid status code '$code', must be between 0 and 254\"\n            );\n        }\n\n        return $this->sendExitCode = (int) $code;\n    }\n\n    /**\n     * Should Whoops push output directly to the client?\n     * If this is false, output will be returned by handleException.\n     *\n     * @param bool|int $send\n     *\n     * @return bool\n     */\n    public function writeToOutput($send = null)\n    {\n        if (func_num_args() == 0) {\n            return $this->sendOutput;\n        }\n\n        return $this->sendOutput = (bool) $send;\n    }\n\n    /**\n     * Handles an exception, ultimately generating a Whoops error page.\n     *\n     * @param Throwable $exception\n     *\n     * @return string Output generated by handlers.\n     */\n    public function handleException($exception)\n    {\n        // Walk the registered handlers in the reverse order\n        // they were registered, and pass off the exception\n        $inspector = $this->getInspector($exception);\n\n        // Capture output produced while handling the exception,\n        // we might want to send it straight away to the client,\n        // or return it silently.\n        $this->system->startOutputBuffering();\n\n        // Just in case there are no handlers:\n        $handlerResponse = null;\n        $handlerContentType = null;\n\n        try {\n            foreach (array_reverse($this->handlerStack) as $handler) {\n                $handler->setRun($this);\n                $handler->setInspector($inspector);\n                $handler->setException($exception);\n\n                // The HandlerInterface does not require an Exception passed to handle()\n                // and neither of our bundled handlers use it.\n                // However, 3rd party handlers may have already relied on this parameter,\n                // and removing it would be possibly breaking for users.\n                $handlerResponse = $handler->handle($exception);\n\n                // Collect the content type for possible sending in the headers.\n                $handlerContentType = method_exists($handler, 'contentType') ? $handler->contentType() : null;\n\n                if (in_array($handlerResponse, [Handler::LAST_HANDLER, Handler::QUIT])) {\n                    // The Handler has handled the exception in some way, and\n                    // wishes to quit execution (Handler::QUIT), or skip any\n                    // other handlers (Handler::LAST_HANDLER). If $this->allowQuit\n                    // is false, Handler::QUIT behaves like Handler::LAST_HANDLER\n                    break;\n                }\n            }\n\n            $willQuit = $handlerResponse == Handler::QUIT && $this->allowQuit();\n        } finally {\n            $output = $this->system->cleanOutputBuffer();\n        }\n\n        // If we're allowed to, send output generated by handlers directly\n        // to the output, otherwise, and if the script doesn't quit, return\n        // it so that it may be used by the caller\n        if ($this->writeToOutput()) {\n            // @todo Might be able to clean this up a bit better\n            if ($willQuit) {\n                // Cleanup all other output buffers before sending our output:\n                while ($this->system->getOutputBufferLevel() > 0) {\n                    $this->system->endOutputBuffering();\n                }\n\n                // Send any headers if needed:\n                if (Misc::canSendHeaders() && $handlerContentType) {\n                    header(\"Content-Type: {$handlerContentType}\");\n                }\n            }\n\n            $this->writeToOutputNow($output);\n        }\n\n        if ($willQuit) {\n            // HHVM fix for https://github.com/facebook/hhvm/issues/4055\n            $this->system->flushOutputBuffer();\n\n            $this->system->stopExecution(\n                $this->sendExitCode()\n            );\n        }\n\n        return $output;\n    }\n\n    /**\n     * Converts generic PHP errors to \\ErrorException instances, before passing them off to be handled.\n     *\n     * This method MUST be compatible with set_error_handler.\n     *\n     * @param int         $level\n     * @param string      $message\n     * @param string|null $file\n     * @param int|null    $line\n     *\n     * @return bool\n     *\n     * @throws ErrorException\n     */\n    public function handleError($level, $message, $file = null, $line = null)\n    {\n        if ($level & $this->system->getErrorReportingLevel()) {\n            foreach ($this->silencedPatterns as $entry) {\n                $pathMatches = (bool) preg_match($entry[\"pattern\"], $file);\n                $levelMatches = $level & $entry[\"levels\"];\n                if ($pathMatches && $levelMatches) {\n                    // Ignore the error, abort handling\n                    // See https://github.com/filp/whoops/issues/418\n                    return true;\n                }\n            }\n\n            // XXX we pass $level for the \"code\" param only for BC reasons.\n            // see https://github.com/filp/whoops/issues/267\n            $exception = new ErrorException($message, /*code*/ $level, /*severity*/ $level, $file, $line);\n            if ($this->canThrowExceptions) {\n                throw $exception;\n            } else {\n                $this->handleException($exception);\n            }\n            // Do not propagate errors which were already handled by Whoops.\n            return true;\n        }\n\n        // Propagate error to the next handler, allows error_get_last() to\n        // work on silenced errors.\n        return false;\n    }\n\n    /**\n     * Special case to deal with Fatal errors and the like.\n     *\n     * @return void\n     */\n    public function handleShutdown()\n    {\n        // If we reached this step, we are in shutdown handler.\n        // An exception thrown in a shutdown handler will not be propagated\n        // to the exception handler. Pass that information along.\n        $this->canThrowExceptions = false;\n\n        // If we are not currently registered, we should not do anything\n        if (!$this->isRegistered) {\n            return;\n        }\n\n        $error = $this->system->getLastError();\n        if ($error && Misc::isLevelFatal($error['type'])) {\n            // If there was a fatal error,\n            // it was not handled in handleError yet.\n            $this->allowQuit = false;\n            $this->handleError(\n                $error['type'],\n                $error['message'],\n                $error['file'],\n                $error['line']\n            );\n        }\n    }\n\n\n    /**\n     * @param InspectorFactoryInterface $factory\n     *\n     * @return void\n     */\n    public function setInspectorFactory(InspectorFactoryInterface $factory)\n    {\n        $this->inspectorFactory = $factory;\n    }\n\n    public function addFrameFilter($filterCallback)\n    {\n        if (!is_callable($filterCallback)) {\n            throw new \\InvalidArgumentException(sprintf(\n                \"A frame filter must be of type callable, %s type given.\",\n                gettype($filterCallback)\n            ));\n        }\n\n        $this->frameFilters[] = $filterCallback;\n        return $this;\n    }\n\n    /**\n     * @param Throwable $exception\n     *\n     * @return InspectorInterface\n     */\n    private function getInspector($exception)\n    {\n        return $this->inspectorFactory->create($exception);\n    }\n\n    /**\n     * Resolves the giving handler.\n     *\n     * @param callable|HandlerInterface $handler\n     *\n     * @return HandlerInterface\n     *\n     * @throws InvalidArgumentException\n     */\n    private function resolveHandler($handler)\n    {\n        if (is_callable($handler)) {\n            $handler = new CallbackHandler($handler);\n        }\n\n        if (!$handler instanceof HandlerInterface) {\n            throw new InvalidArgumentException(\n                \"Handler must be a callable, or instance of \"\n                . \"Whoops\\\\Handler\\\\HandlerInterface\"\n            );\n        }\n\n        return $handler;\n    }\n\n    /**\n     * Echo something to the browser.\n     *\n     * @param string $output\n     *\n     * @return Run\n     */\n    private function writeToOutputNow($output)\n    {\n        if ($this->sendHttpCode() && Misc::canSendHeaders()) {\n            $this->system->setHttpResponseCode(\n                $this->sendHttpCode()\n            );\n        }\n\n        echo $output;\n\n        return $this;\n    }\n}\n"
  },
  {
    "path": "src/Whoops/RunInterface.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops;\n\nuse InvalidArgumentException;\nuse Whoops\\Exception\\ErrorException;\nuse Whoops\\Handler\\HandlerInterface;\n\ninterface RunInterface\n{\n    const EXCEPTION_HANDLER = \"handleException\";\n    const ERROR_HANDLER     = \"handleError\";\n    const SHUTDOWN_HANDLER  = \"handleShutdown\";\n\n    /**\n     * Pushes a handler to the end of the stack\n     *\n     * @throws InvalidArgumentException  If argument is not callable or instance of HandlerInterface\n     * @param  Callable|HandlerInterface $handler\n     * @return Run\n     */\n    public function pushHandler($handler);\n\n    /**\n     * Removes the last handler in the stack and returns it.\n     * Returns null if there\"s nothing else to pop.\n     *\n     * @return null|HandlerInterface\n     */\n    public function popHandler();\n\n    /**\n     * Returns an array with all handlers, in the\n     * order they were added to the stack.\n     *\n     * @return array\n     */\n    public function getHandlers();\n\n    /**\n     * Clears all handlers in the handlerStack, including\n     * the default PrettyPage handler.\n     *\n     * @return Run\n     */\n    public function clearHandlers();\n\n    /**\n     * @return array<callable>\n     */\n    public function getFrameFilters();\n\n    /**\n     * @return Run\n     */\n    public function clearFrameFilters();\n\n    /**\n     * Registers this instance as an error handler.\n     *\n     * @return Run\n     */\n    public function register();\n\n    /**\n     * Unregisters all handlers registered by this Whoops\\Run instance\n     *\n     * @return Run\n     */\n    public function unregister();\n\n    /**\n     * Should Whoops allow Handlers to force the script to quit?\n     *\n     * @param  bool|int $exit\n     * @return bool\n     */\n    public function allowQuit($exit = null);\n\n    /**\n     * Silence particular errors in particular files\n     *\n     * @param  array|string $patterns List or a single regex pattern to match\n     * @param  int          $levels   Defaults to E_STRICT | E_DEPRECATED\n     * @return \\Whoops\\Run\n     */\n    public function silenceErrorsInPaths($patterns, $levels = 10240);\n\n    /**\n     * Should Whoops send HTTP error code to the browser if possible?\n     * Whoops will by default send HTTP code 500, but you may wish to\n     * use 502, 503, or another 5xx family code.\n     *\n     * @param bool|int $code\n     * @return int|false\n     */\n    public function sendHttpCode($code = null);\n\n    /**\n     * Should Whoops exit with a specific code on the CLI if possible?\n     * Whoops will exit with 1 by default, but you can specify something else.\n     *\n     * @param int $code\n     * @return int\n     */\n    public function sendExitCode($code = null);\n\n    /**\n     * Should Whoops push output directly to the client?\n     * If this is false, output will be returned by handleException\n     *\n     * @param  bool|int $send\n     * @return bool\n     */\n    public function writeToOutput($send = null);\n\n    /**\n     * Handles an exception, ultimately generating a Whoops error\n     * page.\n     *\n     * @param  \\Throwable $exception\n     * @return string     Output generated by handlers\n     */\n    public function handleException($exception);\n\n    /**\n     * Converts generic PHP errors to \\ErrorException\n     * instances, before passing them off to be handled.\n     *\n     * This method MUST be compatible with set_error_handler.\n     *\n     * @param int    $level\n     * @param string $message\n     * @param string $file\n     * @param int    $line\n     *\n     * @return bool\n     * @throws ErrorException\n     */\n    public function handleError($level, $message, $file = null, $line = null);\n\n    /**\n     * Special case to deal with Fatal errors and the like.\n     */\n    public function handleShutdown();\n\n    /**\n     * Registers a filter callback in the frame filters stack.\n     *\n     * @param callable $filterCallback\n     * @return \\Whoops\\Run\n     */\n    public function addFrameFilter($filterCallback);\n}\n"
  },
  {
    "path": "src/Whoops/Util/HtmlDumperOutput.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Util;\n\n/**\n * Used as output callable for Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper::dump()\n *\n * @see TemplateHelper::dump()\n */\nclass HtmlDumperOutput\n{\n    private $output;\n\n    public function __invoke($line, $depth)\n    {\n        // A negative depth means \"end of dump\"\n        if ($depth >= 0) {\n            // Adds a two spaces indentation to the line\n            $this->output .= str_repeat('  ', $depth) . $line . \"\\n\";\n        }\n    }\n\n    public function getOutput()\n    {\n        return $this->output;\n    }\n\n    public function clear()\n    {\n        $this->output = null;\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Util/Misc.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Util;\n\nclass Misc\n{\n    /**\n     * Can we at this point in time send HTTP headers?\n     *\n     * Currently this checks if we are even serving an HTTP request,\n     * as opposed to running from a command line.\n     *\n     * If we are serving an HTTP request, we check if it's not too late.\n     *\n     * @return bool\n     */\n    public static function canSendHeaders()\n    {\n        return isset($_SERVER[\"REQUEST_URI\"]) && !headers_sent();\n    }\n\n    public static function isAjaxRequest()\n    {\n        return (\n            !empty($_SERVER['HTTP_X_REQUESTED_WITH'])\n            && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');\n    }\n\n    /**\n     * Check, if possible, that this execution was triggered by a command line.\n     * @return bool\n     */\n    public static function isCommandLine()\n    {\n        return PHP_SAPI == 'cli';\n    }\n\n    /**\n     * Translate ErrorException code into the represented constant.\n     *\n     * @param int $error_code\n     * @return string\n     */\n    public static function translateErrorCode($error_code)\n    {\n        $constants = get_defined_constants(true);\n        if (array_key_exists('Core', $constants)) {\n            foreach ($constants['Core'] as $constant => $value) {\n                if (substr($constant, 0, 2) == 'E_' && $value == $error_code) {\n                    return $constant;\n                }\n            }\n        }\n        return \"E_UNKNOWN\";\n    }\n    \n    /**\n     * Determine if an error level is fatal (halts execution)\n     *\n     * @param int $level\n     * @return bool\n     */\n    public static function isLevelFatal($level)\n    {\n        $errors = E_ERROR;\n        $errors |= E_PARSE;\n        $errors |= E_CORE_ERROR;\n        $errors |= E_CORE_WARNING;\n        $errors |= E_COMPILE_ERROR;\n        $errors |= E_COMPILE_WARNING;\n        return ($level & $errors) > 0;\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Util/SystemFacade.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Util;\n\nclass SystemFacade\n{\n    /**\n     * Turns on output buffering.\n     *\n     * @return bool\n     */\n    public function startOutputBuffering()\n    {\n        return ob_start();\n    }\n\n    /**\n     * @param callable $handler\n     * @param int      $types\n     *\n     * @return callable|null\n     */\n    public function setErrorHandler(callable $handler, $types = 'use-php-defaults')\n    {\n        // Since PHP 5.4 the constant E_ALL contains all errors (even E_STRICT)\n        if ($types === 'use-php-defaults') {\n            $types = E_ALL;\n        }\n        return set_error_handler($handler, $types);\n    }\n\n    /**\n     * @param callable $handler\n     *\n     * @return callable|null\n     */\n    public function setExceptionHandler(callable $handler)\n    {\n        return set_exception_handler($handler);\n    }\n\n    /**\n     * @return void\n     */\n    public function restoreExceptionHandler()\n    {\n        restore_exception_handler();\n    }\n\n    /**\n     * @return void\n     */\n    public function restoreErrorHandler()\n    {\n        restore_error_handler();\n    }\n\n    /**\n     * @param callable $function\n     *\n     * @return void\n     */\n    public function registerShutdownFunction(callable $function)\n    {\n        register_shutdown_function($function);\n    }\n\n    /**\n     * @return string|false\n     */\n    public function cleanOutputBuffer()\n    {\n        return ob_get_clean();\n    }\n\n    /**\n     * @return int\n     */\n    public function getOutputBufferLevel()\n    {\n        return ob_get_level();\n    }\n\n    /**\n     * @return bool\n     */\n    public function endOutputBuffering()\n    {\n        return ob_end_clean();\n    }\n\n    /**\n     * @return void\n     */\n    public function flushOutputBuffer()\n    {\n        flush();\n    }\n\n    /**\n     * @return int\n     */\n    public function getErrorReportingLevel()\n    {\n        return error_reporting();\n    }\n\n    /**\n     * @return array|null\n     */\n    public function getLastError()\n    {\n        return error_get_last();\n    }\n\n    /**\n     * @param int $httpCode\n     *\n     * @return int\n     */\n    public function setHttpResponseCode($httpCode)\n    {\n        if (!headers_sent()) {\n            // Ensure that no 'location' header is present as otherwise this\n            // will override the HTTP code being set here, and mask the\n            // expected error page.\n            header_remove('location');\n        }\n\n        return http_response_code($httpCode);\n    }\n\n    /**\n     * @param int $exitStatus\n     */\n    public function stopExecution($exitStatus)\n    {\n        exit($exitStatus);\n    }\n}\n"
  },
  {
    "path": "src/Whoops/Util/TemplateHelper.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Util;\n\nuse Symfony\\Component\\VarDumper\\Caster\\Caster;\nuse Symfony\\Component\\VarDumper\\Cloner\\AbstractCloner;\nuse Symfony\\Component\\VarDumper\\Cloner\\VarCloner;\nuse Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper;\nuse Whoops\\Exception\\Frame;\n\n/**\n * Exposes useful tools for working with/in templates\n */\nclass TemplateHelper\n{\n    /**\n     * An array of variables to be passed to all templates\n     * @var array\n     */\n    private $variables = [];\n\n    /**\n     * @var HtmlDumper\n     */\n    private $htmlDumper;\n\n    /**\n     * @var HtmlDumperOutput\n     */\n    private $htmlDumperOutput;\n\n    /**\n     * @var AbstractCloner\n     */\n    private $cloner;\n\n    /**\n     * @var string\n     */\n    private $applicationRootPath;\n\n    public function __construct()\n    {\n        // root path for ordinary composer projects\n        $this->applicationRootPath = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__))))));\n    }\n\n    /**\n     * Escapes a string for output in an HTML document\n     *\n     * @param  string $raw\n     * @return string\n     */\n    public function escape($raw)\n    {\n        $flags = ENT_QUOTES;\n\n        // HHVM has all constants defined, but only ENT_IGNORE\n        // works at the moment\n        if (defined(\"ENT_SUBSTITUTE\") && !defined(\"HHVM_VERSION\")) {\n            $flags |= ENT_SUBSTITUTE;\n        } else {\n            // This is for 5.3.\n            // The documentation warns of a potential security issue,\n            // but it seems it does not apply in our case, because\n            // we do not blacklist anything anywhere.\n            $flags |= ENT_IGNORE;\n        }\n\n        $raw = str_replace(chr(9), '    ', $raw);\n\n        return htmlspecialchars($raw, $flags, \"UTF-8\");\n    }\n\n    /**\n     * Escapes a string for output in an HTML document, but preserves\n     * URIs within it, and converts them to clickable anchor elements.\n     *\n     * @param  string $raw\n     * @return string\n     */\n    public function escapeButPreserveUris($raw)\n    {\n        $escaped = $this->escape($raw);\n        return preg_replace(\n            \"@([A-z]+?://([-\\w\\.]+[-\\w])+(:\\d+)?(/([\\w/_\\.#-]*(\\?\\S+)?[^\\.\\s])?)?)@\",\n            \"<a href=\\\"$1\\\" target=\\\"_blank\\\" rel=\\\"noreferrer noopener\\\">$1</a>\",\n            $escaped\n        );\n    }\n\n    /**\n     * Makes sure that the given string breaks on the delimiter.\n     *\n     * @param  string $delimiter\n     * @param  string $s\n     * @return string\n     */\n    public function breakOnDelimiter($delimiter, $s)\n    {\n        $parts = explode($delimiter, $s);\n        foreach ($parts as &$part) {\n            $part = '<span class=\"delimiter\">' . $part . '</span>';\n        }\n\n        return implode($delimiter, $parts);\n    }\n\n    /**\n     * Replace the part of the path that all files have in common.\n     *\n     * @param  string $path\n     * @return string\n     */\n    public function shorten($path)\n    {\n        if ($this->applicationRootPath != \"/\") {\n            $path = str_replace($this->applicationRootPath, '&hellip;', $path);\n        }\n\n        return $path;\n    }\n\n    private function getDumper()\n    {\n        if (!$this->htmlDumper && class_exists('Symfony\\Component\\VarDumper\\Cloner\\VarCloner')) {\n            $this->htmlDumperOutput = new HtmlDumperOutput();\n            // re-use the same var-dumper instance, so it won't re-render the global styles/scripts on each dump.\n            $this->htmlDumper = new HtmlDumper($this->htmlDumperOutput);\n\n            $styles = [\n                'default' => 'color:#FFFFFF; line-height:normal; font:12px \"Inconsolata\", \"Fira Mono\", \"Source Code Pro\", Monaco, Consolas, \"Lucida Console\", monospace !important; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: normal',\n                'num' => 'color:#BCD42A',\n                'const' => 'color: #4bb1b1;',\n                'str' => 'color:#BCD42A',\n                'note' => 'color:#ef7c61',\n                'ref' => 'color:#A0A0A0',\n                'public' => 'color:#FFFFFF',\n                'protected' => 'color:#FFFFFF',\n                'private' => 'color:#FFFFFF',\n                'meta' => 'color:#FFFFFF',\n                'key' => 'color:#BCD42A',\n                'index' => 'color:#ef7c61',\n            ];\n            $this->htmlDumper->setStyles($styles);\n        }\n\n        return $this->htmlDumper;\n    }\n\n    /**\n     * Format the given value into a human readable string.\n     *\n     * @param  mixed $value\n     * @return string\n     */\n    public function dump($value)\n    {\n        $dumper = $this->getDumper();\n\n        if ($dumper) {\n            // re-use the same DumpOutput instance, so it won't re-render the global styles/scripts on each dump.\n            // exclude verbose information (e.g. exception stack traces)\n            if (class_exists('Symfony\\Component\\VarDumper\\Caster\\Caster')) {\n                $cloneVar = $this->getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE);\n                // Symfony VarDumper 2.6 Caster class dont exist.\n            } else {\n                $cloneVar = $this->getCloner()->cloneVar($value);\n            }\n\n            $dumper->dump(\n                $cloneVar,\n                $this->htmlDumperOutput\n            );\n\n            $output = $this->htmlDumperOutput->getOutput();\n            $this->htmlDumperOutput->clear();\n\n            return $output;\n        }\n\n        return htmlspecialchars(print_r($value, true));\n    }\n\n    /**\n     * Format the args of the given Frame as a human readable html string\n     *\n     * @param  Frame $frame\n     * @return string the rendered html\n     */\n    public function dumpArgs(Frame $frame)\n    {\n        // we support frame args only when the optional dumper is available\n        if (!$this->getDumper()) {\n            return '';\n        }\n\n        $html = '';\n        $numFrames = count($frame->getArgs());\n\n        if ($numFrames > 0) {\n            $html = '<ol class=\"linenums\">';\n            foreach ($frame->getArgs() as $j => $frameArg) {\n                $html .= '<li>'. $this->dump($frameArg) .'</li>';\n            }\n            $html .= '</ol>';\n        }\n\n        return $html;\n    }\n\n    /**\n     * Convert a string to a slug version of itself\n     *\n     * @param  string $original\n     * @return string\n     */\n    public function slug($original)\n    {\n        $slug = str_replace(\" \", \"-\", $original);\n        $slug = preg_replace('/[^\\w\\d\\-\\_]/i', '', $slug);\n        return strtolower($slug);\n    }\n\n    /**\n     * Given a template path, render it within its own scope. This\n     * method also accepts an array of additional variables to be\n     * passed to the template.\n     *\n     * @param string $template\n     */\n    public function render($template, ?array $additionalVariables = null)\n    {\n        $variables = $this->getVariables();\n\n        // Pass the helper to the template:\n        $variables[\"tpl\"] = $this;\n\n        if ($additionalVariables !== null) {\n            $variables = array_replace($variables, $additionalVariables);\n        }\n\n        call_user_func(function () {\n            extract(func_get_arg(1));\n            require func_get_arg(0);\n        }, $template, $variables);\n    }\n\n    /**\n     * Sets the variables to be passed to all templates rendered\n     * by this template helper.\n     */\n    public function setVariables(array $variables)\n    {\n        $this->variables = $variables;\n    }\n\n    /**\n     * Sets a single template variable, by its name:\n     *\n     * @param string $variableName\n     * @param mixed  $variableValue\n     */\n    public function setVariable($variableName, $variableValue)\n    {\n        $this->variables[$variableName] = $variableValue;\n    }\n\n    /**\n     * Gets a single template variable, by its name, or\n     * $defaultValue if the variable does not exist\n     *\n     * @param  string $variableName\n     * @param  mixed  $defaultValue\n     * @return mixed\n     */\n    public function getVariable($variableName, $defaultValue = null)\n    {\n        return isset($this->variables[$variableName]) ?\n            $this->variables[$variableName] : $defaultValue;\n    }\n\n    /**\n     * Unsets a single template variable, by its name\n     *\n     * @param string $variableName\n     */\n    public function delVariable($variableName)\n    {\n        unset($this->variables[$variableName]);\n    }\n\n    /**\n     * Returns all variables for this helper\n     *\n     * @return array\n     */\n    public function getVariables()\n    {\n        return $this->variables;\n    }\n\n    /**\n     * Set the cloner used for dumping variables.\n     *\n     * @param AbstractCloner $cloner\n     */\n    public function setCloner($cloner)\n    {\n        $this->cloner = $cloner;\n    }\n\n    /**\n     * Get the cloner used for dumping variables.\n     *\n     * @return AbstractCloner\n     */\n    public function getCloner()\n    {\n        if (!$this->cloner) {\n            $this->cloner = new VarCloner();\n        }\n        return $this->cloner;\n    }\n\n    /**\n     * Set the application root path.\n     *\n     * @param string $applicationRootPath\n     */\n    public function setApplicationRootPath($applicationRootPath)\n    {\n        $this->applicationRootPath = $applicationRootPath;\n    }\n\n    /**\n     * Return the application root path.\n     *\n     * @return string\n     */\n    public function getApplicationRootPath()\n    {\n        return $this->applicationRootPath;\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/Exception/FormatterTest.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Exception;\n\nuse Whoops\\TestCase;\n\nclass FormatterTest extends TestCase\n{\n    public function testPlain()\n    {\n        $msg = 'Sample exception message foo';\n        $output = Formatter::formatExceptionPlain(new Inspector(new \\Exception($msg)));\n        $this->assertStringContains($msg, $output);\n        $this->assertStringContains('Stacktrace', $output);\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/Exception/FrameCollectionTest.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Exception;\n\nuse Whoops\\TestCase;\n\nclass FrameCollectionTest extends TestCase\n{\n    /**\n     * Stupid little counter for tagging frames\n     * with a unique but predictable id\n     * @var int\n     */\n    private $frameIdCounter = 0;\n\n    /**\n     * @return array\n     */\n    public function getFrameData()\n    {\n        $id = ++$this->frameIdCounter;\n        return [\n            'file'     => __DIR__ . '/../../fixtures/frame.lines-test.php',\n            'line'     => $id,\n            'function' => 'test-' . $id,\n            'class'    => 'MyClass',\n            'args'     => [true, 'hello'],\n        ];\n    }\n\n    /**\n     * @param  int   $total\n     * @return array\n     */\n    public function getFrameDataList($total)\n    {\n        $total = max((int) $total, 1);\n        $self  = $this;\n        $frames = array_map(function () use ($self) {\n            return $self->getFrameData();\n        }, range(1, $total));\n\n        return $frames;\n    }\n\n    /**\n     * @param  array                            $frames\n     * @return \\Whoops\\Exception\\FrameCollection\n     */\n    private function getFrameCollectionInstance($frames = null)\n    {\n        if ($frames === null) {\n            $frames = $this->getFrameDataList(10);\n        }\n\n        return new FrameCollection($frames);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\FrameCollection::offsetExists\n     */\n    public function testArrayAccessExists()\n    {\n        $collection = $this->getFrameCollectionInstance();\n        $this->assertArrayHasKey(0, $collection);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\FrameCollection::offsetGet\n     */\n    public function testArrayAccessGet()\n    {\n        $collection = $this->getFrameCollectionInstance();\n        $this->assertInstanceOf('Whoops\\\\Exception\\\\Frame', $collection[0]);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\FrameCollection::offsetSet\n     */\n    public function testArrayAccessSet()\n    {\n        $collection = $this->getFrameCollectionInstance();\n\n        $this->expectExceptionOfType('Exception');\n\n        $collection[0] = 'foo';\n    }\n\n    /**\n     * @covers Whoops\\Exception\\FrameCollection::offsetUnset\n     */\n    public function testArrayAccessUnset()\n    {\n        $collection = $this->getFrameCollectionInstance();\n\n        $this->expectExceptionOfType('Exception');\n\n        unset($collection[0]);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\FrameCollection::filter\n     * @covers Whoops\\Exception\\FrameCollection::count\n     */\n    public function testFilterFrames()\n    {\n        $frames = $this->getFrameCollectionInstance();\n\n        // Filter out all frames with a line number under 6\n        $frames->filter(function ($frame) {\n            return $frame->getLine() <= 5;\n        });\n\n        $this->assertCount(5, $frames);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\FrameCollection::map\n     */\n    public function testMapFrames()\n    {\n        $frames = $this->getFrameCollectionInstance();\n\n        // Filter out all frames with a line number under 6\n        $frames->map(function ($frame) {\n            $frame->addComment(\"This is cool\", \"test\");\n            return $frame;\n        });\n\n        $this->assertCount(10, $frames);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\FrameCollection::map\n     */\n    public function testMapFramesEnforceType()\n    {\n        $frames = $this->getFrameCollectionInstance();\n\n        $this->expectExceptionOfType('UnexpectedValueException');\n\n        // Filter out all frames with a line number under 6\n        $frames->map(function ($frame) {\n            return \"bajango\";\n        });\n    }\n\n    /**\n     * @covers Whoops\\Exception\\FrameCollection::getArray\n     */\n    public function testGetArray()\n    {\n        $frames = $this->getFrameCollectionInstance();\n        $frames = $frames->getArray();\n\n        $this->assertCount(10, $frames);\n        foreach ($frames as $frame) {\n            $this->assertInstanceOf('Whoops\\\\Exception\\\\Frame', $frame);\n        }\n    }\n\n    /**\n     * @covers Whoops\\Exception\\FrameCollection::getArray\n     */\n    public function testGetArrayImmutable()\n    {\n        $frames = $this->getFrameCollectionInstance();\n        $arr = $frames->getArray();\n        $arr[0] = 'foobar';\n        $newCopy = $frames->getArray();\n        $this->assertNotSame($arr[0], $newCopy);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\FrameCollection::getIterator\n     */\n    public function testCollectionIsIterable()\n    {\n        $frames = $this->getFrameCollectionInstance();\n        foreach ($frames as $frame) {\n            $this->assertInstanceOf('Whoops\\\\Exception\\\\Frame', $frame);\n        }\n    }\n\n    /**\n     * @covers Whoops\\Exception\\FrameCollection::serialize\n     * @covers Whoops\\Exception\\FrameCollection::unserialize\n     */\n    public function testCollectionIsSerializable()\n    {\n        $frames           = $this->getFrameCollectionInstance();\n        $serializedFrames = serialize($frames);\n        $newFrames        = unserialize($serializedFrames);\n\n        foreach ($newFrames as $frame) {\n            $this->assertInstanceOf('Whoops\\\\Exception\\\\Frame', $frame);\n        }\n    }\n\n    /**\n     * @covers Whoops\\Exception\\FrameCollection::topDiff\n     */\n    public function testTopDiff()\n    {\n        $commonFrameTail = $this->getFrameDataList(3);\n\n        $diffFrame = ['line' => $this->frameIdCounter] + $this->getFrameData();\n\n        $frameCollection1 = new FrameCollection(array_merge([\n            $diffFrame,\n        ], $commonFrameTail));\n\n        $frameCollection2 = new FrameCollection(array_merge([\n            $this->getFrameData(),\n        ], $commonFrameTail));\n\n        $diff = $frameCollection1->topDiff($frameCollection2);\n\n        $this->assertCount(1, $diff);\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/Exception/FrameTest.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Exception;\n\nuse Whoops\\TestCase;\n\nclass FrameTest extends TestCase\n{\n    /**\n     * @return array\n     */\n    private function getFrameData()\n    {\n        return [\n            'file'     => __DIR__ . '/../../fixtures/frame.lines-test.php',\n            'line'     => 0,\n            'function' => 'test',\n            'class'    => 'MyClass',\n            'args'     => [true, 'hello'],\n        ];\n    }\n\n    /**\n     * @param  array $data\n     * @return Frame\n     */\n    private function getFrameInstance($data = null)\n    {\n        if ($data === null) {\n            $data = $this->getFrameData();\n        }\n\n        return new Frame($data);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::getFile\n     */\n    public function testGetFile()\n    {\n        $data  = $this->getFrameData();\n        $frame = $this->getFrameInstance($data);\n\n        $this->assertEquals($frame->getFile(), $data['file']);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::getLine\n     */\n    public function testGetLine()\n    {\n        $data  = $this->getFrameData();\n        $frame = $this->getFrameInstance($data);\n\n        $this->assertEquals($frame->getLine(), $data['line']);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::getClass\n     */\n    public function testGetClass()\n    {\n        $data  = $this->getFrameData();\n        $frame = $this->getFrameInstance($data);\n\n        $this->assertEquals($frame->getClass(), $data['class']);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::getFunction\n     */\n    public function testGetFunction()\n    {\n        $data  = $this->getFrameData();\n        $frame = $this->getFrameInstance($data);\n\n        $this->assertEquals($frame->getFunction(), $data['function']);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::getArgs\n     */\n    public function testGetArgs()\n    {\n        $data  = $this->getFrameData();\n        $frame = $this->getFrameInstance($data);\n\n        $this->assertEquals($frame->getArgs(), $data['args']);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::getFileContents\n     */\n    public function testGetFileContents()\n    {\n        $data  = $this->getFrameData();\n        $frame = $this->getFrameInstance($data);\n\n        $this->assertStringEqualsFile($data['file'], $frame->getFileContents());\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::getFileContents\n     * @testWith [\"[internal]\"]\n     *           [\"Unknown\"]\n     * @see https://github.com/filp/whoops/pull/599\n     */\n    public function testGetFileContentsWhenFrameIsNotRelatedToSpecificFile($fakeFilename)\n    {\n        $data  = array_merge($this->getFrameData(), ['file' => $fakeFilename]);\n        $frame = $this->getFrameInstance($data);\n\n        $this->assertNull($frame->getFileContents());\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::getFileLines\n     */\n    public function testGetFileLines()\n    {\n        $data  = $this->getFrameData();\n        $frame = $this->getFrameInstance($data);\n\n        $lines = explode(\"\\n\", $frame->getFileContents());\n        $this->assertEquals($frame->getFileLines(), $lines);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::getFileLines\n     */\n    public function testGetFileLinesRange()\n    {\n        $data  = $this->getFrameData();\n        $frame = $this->getFrameInstance($data);\n\n        $lines = $frame->getFileLines(0, 3);\n\n        $this->assertEquals($lines[0], '<?php');\n        $this->assertEquals($lines[1], '// Line 2');\n        $this->assertEquals($lines[2], '// Line 3');\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::addComment\n     * @covers Whoops\\Exception\\Frame::getComments\n     */\n    public function testGetComments()\n    {\n        $frame    = $this->getFrameInstance();\n        $testComments = [\n            'Dang, yo!',\n            'Errthangs broken!',\n            'Dayumm!',\n        ];\n\n        $frame->addComment($testComments[0]);\n        $frame->addComment($testComments[1]);\n        $frame->addComment($testComments[2]);\n\n        $comments = $frame->getComments();\n\n        $this->assertCount(3, $comments);\n\n        $this->assertEquals($comments[0]['comment'], $testComments[0]);\n        $this->assertEquals($comments[1]['comment'], $testComments[1]);\n        $this->assertEquals($comments[2]['comment'], $testComments[2]);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::addComment\n     * @covers Whoops\\Exception\\Frame::getComments\n     */\n    public function testGetFilteredComments()\n    {\n        $frame    = $this->getFrameInstance();\n        $testComments = [\n            ['Dang, yo!', 'test'],\n            ['Errthangs broken!', 'test'],\n            'Dayumm!',\n        ];\n\n        $frame->addComment($testComments[0][0], $testComments[0][1]);\n        $frame->addComment($testComments[1][0], $testComments[1][1]);\n        $frame->addComment($testComments[2][0], $testComments[2][1]);\n\n        $comments = $frame->getComments('test');\n\n        $this->assertCount(2, $comments);\n        $this->assertEquals($comments[0]['comment'], $testComments[0][0]);\n        $this->assertEquals($comments[1]['comment'], $testComments[1][0]);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::serialize\n     * @covers Whoops\\Exception\\Frame::unserialize\n     */\n    public function testFrameIsSerializable()\n    {\n        $data            = $this->getFrameData();\n        $frame           = $this->getFrameInstance();\n        $commentText     = \"Gee I hope this works\";\n        $commentContext  = \"test\";\n\n        $frame->addComment($commentText, $commentContext);\n\n        $serializedFrame = serialize($frame);\n        $newFrame        = unserialize($serializedFrame);\n\n        $this->assertInstanceOf('Whoops\\\\Exception\\\\Frame', $newFrame);\n        $this->assertEquals($newFrame->getFile(), $data['file']);\n        $this->assertEquals($newFrame->getLine(), $data['line']);\n\n        $comments = $newFrame->getComments();\n        $this->assertCount(1, $comments);\n        $this->assertEquals($comments[0][\"comment\"], $commentText);\n        $this->assertEquals($comments[0][\"context\"], $commentContext);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Frame::equals\n     */\n    public function testEquals()\n    {\n        $frame1 = $this->getFrameInstance(['line' => 1, 'file' => 'test-file.php']);\n        $frame2 = $this->getFrameInstance(['line' => 1, 'file' => 'test-file.php']);\n        $this->assertTrue ($frame1->equals($frame2));\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/Exception/InspectorTest.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Exception;\n\nuse Exception;\nuse Whoops\\TestCase;\n\nclass InspectorTest extends TestCase\n{\n    /**\n     * @param  string     $message\n     * @param  int        $code\n     * @param  Exception $previous\n     * @return Exception\n     */\n    protected function getException($message = \"\", $code = 0, $previous = null)\n    {\n        return new Exception($message, $code, $previous);\n    }\n\n    /**\n     * @param  Exception                  $exception|null\n     * @return \\Whoops\\Exception\\Inspector\n     */\n    protected function getInspectorInstance($exception = null)\n    {\n        return new Inspector($exception);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Inspector::getFrames\n     */\n    public function testCorrectNestedFrames($value = '')\n    {\n        // Create manually to have a different line number from the outer\n        $inner = new Exception('inner');\n        $outer = $this->getException('outer', 0, $inner);\n        $inspector = $this->getInspectorInstance($outer);\n        $frames = $inspector->getFrames();\n        $this->assertSame($outer->getLine(), $frames[0]->getLine());\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Inspector::getFrames\n     */\n    public function testDoesNotFailOnPHP7ErrorObject()\n    {\n        if (!class_exists('Error')) {\n            $this->markTestSkipped(\n              'PHP 5.x, the Error class is not available.'\n            );\n        }\n\n        $inner = new \\Error('inner');\n        $outer = $this->getException('outer', 0, $inner);\n        $inspector = $this->getInspectorInstance($outer);\n        $frames = $inspector->getFrames();\n        $this->assertSame($outer->getLine(), $frames[0]->getLine());\n    }\n    /**\n     * @covers Whoops\\Exception\\Inspector::getExceptionName\n     */\n    public function testReturnsCorrectExceptionName()\n    {\n        $exception = $this->getException();\n        $inspector = $this->getInspectorInstance($exception);\n\n        $this->assertEquals(get_class($exception), $inspector->getExceptionName());\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Inspector::__construct\n     * @covers Whoops\\Exception\\Inspector::getException\n     */\n    public function testExceptionIsStoredAndReturned()\n    {\n        $exception = $this->getException();\n        $inspector = $this->getInspectorInstance($exception);\n\n        $this->assertSame($exception, $inspector->getException());\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Inspector::getFrames\n     */\n    public function testGetFramesReturnsCollection()\n    {\n        $exception = $this->getException();\n        $inspector = $this->getInspectorInstance($exception);\n\n        $this->assertInstanceOf('Whoops\\\\Exception\\\\FrameCollection', $inspector->getFrames());\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Inspector::getFrames\n     */\n    public function testGetFramesWithFiltersReturnsCollection()\n    {\n        $exception = $this->getException();\n        $inspector = $this->getInspectorInstance($exception);\n\n        $frames = $inspector->getFrames([\n            function(Frame $frame) {\n                return true;\n            },\n        ]);\n\n        $this->assertInstanceOf('Whoops\\\\Exception\\\\FrameCollection', $frames);\n        $this->assertNotEmpty($frames);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Inspector::getFrames\n     */\n    public function testGetFramesWithFiltersReturnsEmptyCollection()\n    {\n        $exception = $this->getException();\n        $inspector = $this->getInspectorInstance($exception);\n\n        $frames = $inspector->getFrames([\n            function(Frame $frame) {\n                return false;\n            },\n        ]);\n\n        $this->assertInstanceOf('Whoops\\\\Exception\\\\FrameCollection', $frames);\n        $this->assertEmpty($frames);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Inspector::hasPreviousException\n     * @covers Whoops\\Exception\\Inspector::getPreviousExceptionInspector\n     */\n    public function testPreviousException()\n    {\n        $previousException = $this->getException(\"I'm here first!\");\n        $exception         = $this->getException(\"Oh boy\", 0, $previousException);\n        $inspector         = $this->getInspectorInstance($exception);\n\n        $this->assertTrue($inspector->hasPreviousException());\n        $this->assertEquals($previousException, $inspector->getPreviousExceptionInspector()->getException());\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Inspector::hasPreviousException\n     */\n    public function testNegativeHasPreviousException()\n    {\n        $exception         = $this->getException(\"Oh boy\");\n        $inspector         = $this->getInspectorInstance($exception);\n\n        $this->assertFalse($inspector->hasPreviousException());\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Inspector::getPreviousExceptions\n     */\n    public function testGetPreviousExceptionsReturnsListOfExceptions()\n    {\n        $exception1        = $this->getException('My first exception');\n        $exception2        = $this->getException('My second exception', 0, $exception1);\n        $exception3        = $this->getException('And the third one', 0, $exception2);\n\n        $inspector         = $this->getInspectorInstance($exception3);\n\n        $previousExceptions = $inspector->getPreviousExceptions();\n        $this->assertCount(2, $previousExceptions);\n        $this->assertEquals($exception2, $previousExceptions[0]);\n        $this->assertEquals($exception1, $previousExceptions[1]);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Inspector::getPreviousExceptions\n     */\n    public function testGetPreviousExceptionsReturnsEmptyListIfThereAreNoPreviousExceptions()\n    {\n        $exception         = $this->getException('My exception');\n        $inspector         = $this->getInspectorInstance($exception);\n\n        $previousExceptions = $inspector->getPreviousExceptions();\n        $this->assertCount(0, $previousExceptions);\n    }\n\n    /**\n     * @covers Whoops\\Exception\\Inspector::getPreviousExceptionMessages\n     */\n    public function testGetPreviousExceptionMessages()\n    {\n        $exception1        = $this->getException('My first exception');\n        $exception2        = $this->getException('My second exception', 0, $exception1);\n        $exception3        = $this->getException('And the third one', 0, $exception2);\n\n        $inspector         = $this->getInspectorInstance($exception3);\n\n        $previousExceptions = $inspector->getPreviousExceptionMessages();\n\n        $this->assertEquals($exception2->getMessage(), $previousExceptions[0]);\n        $this->assertEquals($exception1->getMessage(), $previousExceptions[1]);\n    }\n\n\n    /**\n     * @covers Whoops\\Exception\\Inspector::getPreviousExceptionCodes\n     */\n    public function testGetPreviousExceptionCodes()\n    {\n        $exception1        = $this->getException('My first exception', 99);\n        $exception2        = $this->getException('My second exception', 20, $exception1);\n        $exception3        = $this->getException('And the third one', 10, $exception2);\n\n        $inspector         = $this->getInspectorInstance($exception3);\n\n        $previousExceptions = $inspector->getPreviousExceptionCodes();\n\n        $this->assertEquals($exception2->getCode(), $previousExceptions[0]);\n        $this->assertEquals($exception1->getCode(), $previousExceptions[1]);\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/Handler/CallbackHandlerTest.php",
    "content": "<?php\n\nnamespace Whoops\\Handler;\n\nuse Whoops\\TestCase;\n\nclass CallbackHandlerTest extends TestCase\n{\n    public function testSimplifiedBacktrace()\n    {\n        $handler = new CallbackHandler(function ($exception, $inspector, $run) {\n            return debug_backtrace();\n        });\n        $backtrace = $handler->handle();\n        \n        foreach ($backtrace as $frame) {\n            $this->assertStringNotContains('call_user_func', $frame['function']);\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/Handler/JsonResponseHandlerTest.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Handler;\n\nuse RuntimeException;\nuse Whoops\\TestCase;\n\nclass JsonResponseHandlerTest extends TestCase\n{\n    /**\n     * @return \\Whoops\\Handler\\JsonResponseHandler\n     */\n    private function getHandler()\n    {\n        return new JsonResponseHandler();\n    }\n\n    /**\n     * @return RuntimeException\n     */\n    public function getException($message = 'test message')\n    {\n        return new RuntimeException($message);\n    }\n\n    /**\n     * @param  bool  $withTrace\n     * @return array\n     */\n    private function getJsonResponseFromHandler($withTrace = false, $jsonApi = false)\n    {\n        $handler = $this->getHandler();\n        $handler->setJsonApi($jsonApi);\n        $handler->addTraceToOutput($withTrace);\n\n        $run = $this->getRunInstance();\n        $run->pushHandler($handler);\n        $run->register();\n\n        $exception = $this->getException();\n        ob_start();\n        $run->handleException($exception);\n        $json = json_decode(ob_get_clean(), true);\n\n        // Check that the json response is parse-able:\n        $this->assertEquals(json_last_error(), JSON_ERROR_NONE);\n\n        return $json;\n    }\n\n    /**\n     * @covers Whoops\\Handler\\JsonResponseHandler::addTraceToOutput\n     * @covers Whoops\\Handler\\JsonResponseHandler::handle\n     */\n    public function testReturnsWithoutFrames()\n    {\n        $json = $this->getJsonResponseFromHandler($withTrace = false,$jsonApi = false);\n\n        // Check that the response has the expected keys:\n        $this->assertArrayHasKey('error', $json);\n        $this->assertArrayHasKey('type', $json['error']);\n        $this->assertArrayHasKey('file', $json['error']);\n        $this->assertArrayHasKey('line', $json['error']);\n\n        // Check the field values:\n        $this->assertEquals($json['error']['file'], __FILE__);\n        $this->assertEquals($json['error']['message'], 'test message');\n        $this->assertEquals($json['error']['type'], get_class($this->getException()));\n\n        // Check that the trace is NOT returned:\n        $this->assertArrayNotHasKey('trace', $json['error']);\n    }\n\n    /**\n     * @covers Whoops\\Handler\\JsonResponseHandler::addTraceToOutput\n     * @covers Whoops\\Handler\\JsonResponseHandler::handle\n     */\n    public function testReturnsWithFrames()\n    {\n        $json = $this->getJsonResponseFromHandler($withTrace = true,$jsonApi = false);\n\n        // Check that the trace is returned:\n        $this->assertArrayHasKey('trace', $json['error']);\n\n        // Check that a random frame has the expected fields\n        $traceFrame = reset($json['error']['trace']);\n        $this->assertArrayHasKey('file', $traceFrame);\n        $this->assertArrayHasKey('line', $traceFrame);\n        $this->assertArrayHasKey('function', $traceFrame);\n        $this->assertArrayHasKey('class', $traceFrame);\n        $this->assertArrayHasKey('args', $traceFrame);\n    }\n\n    /**\n     * @covers Whoops\\Handler\\JsonResponseHandler::addTraceToOutput\n     * @covers Whoops\\Handler\\JsonResponseHandler::handle\n     */\n    public function testReturnsJsonApi()\n    {\n        $json = $this->getJsonResponseFromHandler($withTrace = false,$jsonApi = true);\n\n        // Check that the response has the expected keys:\n        $this->assertArrayHasKey('errors', $json);\n        $this->assertArrayHasKey('type', $json['errors'][0]);\n        $this->assertArrayHasKey('file', $json['errors'][0]);\n        $this->assertArrayHasKey('line', $json['errors'][0]);\n\n        // Check the field values:\n        $this->assertEquals($json['errors'][0]['file'], __FILE__);\n        $this->assertEquals($json['errors'][0]['message'], 'test message');\n        $this->assertEquals($json['errors'][0]['type'], get_class($this->getException()));\n\n        // Check that the trace is NOT returned:\n        $this->assertArrayNotHasKey('trace', $json['errors']);\n    }\n\n \n}\n"
  },
  {
    "path": "tests/Whoops/Handler/PlainTextHandlerTest.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Handler;\n\nuse RuntimeException;\nuse StdClass;\nuse Whoops\\TestCase;\nuse Whoops\\Exception\\Frame;\n\nclass PlainTextHandlerTest extends TestCase\n{\n    const DEFAULT_EXCEPTION_LINE = 34;\n    const DEFAULT_LINE_OF_CALLER = 65;\n\n    /**\n     * @throws \\InvalidArgumentException        If argument is not null or a LoggerInterface\n     * @param  \\Psr\\Log\\LoggerInterface|null    $logger\n     * @return \\Whoops\\Handler\\PlainTextHandler\n     */\n    private function getHandler($logger = null)\n    {\n        return new PlainTextHandler($logger);\n    }\n\n    /**\n     * @return RuntimeException\n     */\n    public function getException($message = 'test message')\n    {\n        return new RuntimeException($message);\n    }\n\n    /**\n     * @param  bool $withTrace\n     * @param  bool $withTraceArgs\n     * @param  int $traceFunctionArgsOutputLimit\n     * @param  bool $loggerOnly\n     * @param bool $previousOutput\n     * @param  null $exception\n     * @return array\n     */\n    private function getPlainTextFromHandler(\n        $withTrace = false,\n        $withTraceArgs = false,\n        $traceFunctionArgsOutputLimit = 1024,\n        $loggerOnly = false,\n        $previousOutput = false,\n        $exception = null\n    ) {\n        $handler = $this->getHandler();\n        $handler->addTraceToOutput($withTrace);\n        $handler->addTraceFunctionArgsToOutput($withTraceArgs);\n        $handler->setTraceFunctionArgsOutputLimit($traceFunctionArgsOutputLimit);\n        $handler->addPreviousToOutput($previousOutput);\n        $handler->loggerOnly($loggerOnly);\n\n        $run = $this->getRunInstance();\n        $run->pushHandler($handler);\n        $run->register();\n\n        $exception = $exception ?: $this->getException();\n\n        try {\n            ob_start();\n            $run->handleException($exception);\n        } finally {\n            return ob_get_clean();\n        }\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PlainTextHandler::__construct\n     * @covers Whoops\\Handler\\PlainTextHandler::setLogger\n     */\n    public function testConstructor()\n    {\n        $this->expectExceptionOfType('InvalidArgumentException');\n\n        $this->getHandler(new StdClass());\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PlainTextHandler::setLogger\n     */\n    public function testSetLogger()\n    {\n        $this->expectExceptionOfType('InvalidArgumentException');\n\n        $this->getHandler()->setLogger(new StdClass());\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PlainTextHandler::addTraceToOutput\n     */\n    public function testAddTraceToOutput()\n    {\n        $handler = $this->getHandler();\n\n        $this->assertEquals($handler, $handler->addTraceToOutput(true));\n        $this->assertTrue($handler->addTraceToOutput());\n\n        $handler->addTraceToOutput(false);\n        $this->assertFalse($handler->addTraceToOutput());\n\n        $handler->addTraceToOutput(null);\n        $this->assertEquals(null, $handler->addTraceToOutput());\n\n        $handler->addTraceToOutput(1);\n        $this->assertTrue($handler->addTraceToOutput());\n\n        $handler->addTraceToOutput(0);\n        $this->assertFalse($handler->addTraceToOutput());\n\n        $handler->addTraceToOutput('');\n        $this->assertFalse($handler->addTraceToOutput());\n\n        $handler->addTraceToOutput('false');\n        $this->assertTrue($handler->addTraceToOutput());\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PlainTextHandler::addTraceFunctionArgsToOutput\n     */\n    public function testAddTraceFunctionArgsToOutput()\n    {\n        $handler = $this->getHandler();\n\n        $this->assertEquals($handler, $handler->addTraceFunctionArgsToOutput(true));\n        $this->assertTrue($handler->addTraceFunctionArgsToOutput());\n\n        $handler->addTraceFunctionArgsToOutput(false);\n        $this->assertFalse($handler->addTraceFunctionArgsToOutput());\n\n        $handler->addTraceFunctionArgsToOutput(null);\n        $this->assertEquals(null, $handler->addTraceFunctionArgsToOutput());\n\n        $handler->addTraceFunctionArgsToOutput(1);\n        $this->assertEquals(1, $handler->addTraceFunctionArgsToOutput());\n\n        $handler->addTraceFunctionArgsToOutput(0);\n        $this->assertEquals(0, $handler->addTraceFunctionArgsToOutput());\n\n        $handler->addTraceFunctionArgsToOutput('');\n        $this->assertFalse($handler->addTraceFunctionArgsToOutput());\n\n        $handler->addTraceFunctionArgsToOutput('false');\n        $this->assertTrue($handler->addTraceFunctionArgsToOutput());\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PlainTextHandler::setTraceFunctionArgsOutputLimit\n     * @covers Whoops\\Handler\\PlainTextHandler::getTraceFunctionArgsOutputLimit\n     */\n    public function testGetSetTraceFunctionArgsOutputLimit()\n    {\n        $addTraceFunctionArgsToOutput = 10240;\n\n        $handler = $this->getHandler();\n\n        $handler->setTraceFunctionArgsOutputLimit($addTraceFunctionArgsToOutput);\n        $this->assertEquals($addTraceFunctionArgsToOutput, $handler->getTraceFunctionArgsOutputLimit());\n\n        $handler->setTraceFunctionArgsOutputLimit('1024kB');\n        $this->assertEquals(1024, $handler->getTraceFunctionArgsOutputLimit());\n\n        $handler->setTraceFunctionArgsOutputLimit('true');\n        $this->assertEquals(0, $handler->getTraceFunctionArgsOutputLimit());\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PlainTextHandler::loggerOnly\n     */\n    public function testLoggerOnly()\n    {\n        $handler = $this->getHandler();\n\n        $this->assertEquals($handler, $handler->loggerOnly(true));\n        $this->assertTrue($handler->loggerOnly());\n\n        $handler->loggerOnly(false);\n        $this->assertFalse($handler->loggerOnly());\n\n        $handler->loggerOnly(null);\n        $this->assertEquals(null, $handler->loggerOnly());\n\n        $handler->loggerOnly(1);\n        $this->assertTrue($handler->loggerOnly());\n\n        $handler->loggerOnly(0);\n        $this->assertFalse($handler->loggerOnly());\n\n        $handler->loggerOnly('');\n        $this->assertFalse($handler->loggerOnly());\n\n        $handler->loggerOnly('false');\n        $this->assertTrue($handler->loggerOnly());\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PlainTextHandler::addTraceToOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::handle\n     */\n    public function testReturnsWithoutFramesOutput()\n    {\n        $text = $this->getPlainTextFromHandler(\n            $withTrace = false,\n            $withTraceArgs = true,\n            $traceFunctionArgsOutputLimit = 1024,\n            $loggerOnly = false\n        );\n\n        // Check that the response has the correct value:\n        // Check that the trace is NOT returned:\n        $this->assertEquals(\n            sprintf(\n                \"%s: %s in file %s on line %d\\n\",\n                get_class($this->getException()),\n                'test message',\n                __FILE__,\n                self::DEFAULT_EXCEPTION_LINE\n            ),\n            $text\n        );\n    }\n\n    public function testReturnsWithoutPreviousExceptions()\n    {\n        $text = $this->getPlainTextFromHandler(\n            $withTrace = false,\n            $withTraceArgs = true,\n            $traceFunctionArgsOutputLimit = 1024,\n            $loggerOnly = false,\n            $previousOutput = false,\n            new RuntimeException('Outer exception message', 0, new RuntimeException('Inner exception message'))\n        );\n\n        // Check that the response does not contain Inner exception message:\n        $this->assertStringNotContains(\n            sprintf(\n                \"%s: %s in file %s\",\n                RuntimeException::class,\n                'Inner exception message',\n                __FILE__\n            ),\n            $text\n        );\n    }\n\n    public function testReturnsWithPreviousExceptions()\n    {\n        $text = $this->getPlainTextFromHandler(\n            $withTrace = false,\n            $withTraceArgs = true,\n            $traceFunctionArgsOutputLimit = 1024,\n            $loggerOnly = false,\n            $previousOutput = true,\n            new RuntimeException('Outer exception message', 0, new RuntimeException('Inner exception message'))\n        );\n\n        // Check that the response has the correct message:\n        $this->assertEquals(\n            sprintf(\n                \"%s: %s in file %s on line %d\\n\" .\n                \"%s: %s in file %s on line %d\\n\",\n                RuntimeException::class,\n                'Outer exception message',\n                __FILE__,\n                261,\n                \"\\nCaused by\\n\" . RuntimeException::class,\n                'Inner exception message',\n                __FILE__,\n                261\n            ),\n            $text\n        );\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PlainTextHandler::addTraceToOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::getTraceOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::canOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::handle\n     */\n    public function testReturnsWithFramesOutput()\n    {\n        $text = $this->getPlainTextFromHandler(\n            $withTrace = true,\n            $withTraceArgs = false,\n            $traceFunctionArgsOutputLimit = 1024,\n            $loggerOnly = false\n        );\n\n        // Check that the response has the correct value:\n        $this->assertStringContains('Stack trace:', $text);\n\n        // Check that the trace is returned:\n        $this->assertStringContains(\n            sprintf(\n                '%3d. %s->%s() %s:%d',\n                2,\n                __CLASS__,\n                'getException',\n                __FILE__,\n                self::DEFAULT_LINE_OF_CALLER\n            ),\n            $text\n        );\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PlainTextHandler::addTraceToOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::addTraceFunctionArgsToOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::getTraceOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::getFrameArgsOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::canOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::handle\n     */\n    public function testReturnsWithFramesAndArgsOutput()\n    {\n        $text = $this->getPlainTextFromHandler(\n            $withTrace = true,\n            $withTraceArgs = true,\n            $traceFunctionArgsOutputLimit = 2048,\n            $loggerOnly = false\n        );\n\n        $lines = explode(\"\\n\", $text);\n\n        // Check that the trace is returned with all arguments:\n        $this->assertGreaterThan(60, count($lines));\n\n        // Check that the response has the correct value:\n        $this->assertStringContains('Stack trace:', $text);\n\n        // Check that the trace is returned:\n        $this->assertStringContains(\n            sprintf(\n                '%3d. %s->%s() %s:%d',\n                2,\n                'Whoops\\Handler\\PlainTextHandlerTest',\n                'getException',\n                __FILE__,\n                self::DEFAULT_LINE_OF_CALLER\n            ),\n            $text\n        );\n        // Check that the trace arguments are returned:\n        $this->assertStringContains(sprintf(\n            '%s  string(%d) \"%s\"',\n            PlainTextHandler::VAR_DUMP_PREFIX,\n            strlen('test message'),\n            'test message'\n            ), $text\n        );\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PlainTextHandler::addTraceToOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::addTraceFunctionArgsToOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::getTraceOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::getFrameArgsOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::canOutput\n     * @covers Whoops\\Handler\\PlainTextHandler::handle\n     */\n    public function testReturnsWithFramesAndLimitedArgsOutput()\n    {\n        $text = $this->getPlainTextFromHandler(\n            $withTrace = true,\n            $withTraceArgs = 3,\n            $traceFunctionArgsOutputLimit = 1024,\n            $loggerOnly = false\n        );\n\n        // Check that the response has the correct value:\n        $this->assertStringContains('Stack trace:', $text);\n\n        // Check that the trace is returned:\n        $this->assertStringContains(\n            sprintf(\n                '%3d. %s->%s() %s:%d',\n                2,\n                'Whoops\\Handler\\PlainTextHandlerTest',\n                'getException',\n                __FILE__,\n                self::DEFAULT_LINE_OF_CALLER\n            ),\n            $text\n        );\n\n        // Check that the trace arguments are returned:\n        $this->assertStringContains(sprintf(\n            '%s  string(%d) \"%s\"',\n            PlainTextHandler::VAR_DUMP_PREFIX,\n            strlen('test message'),\n            'test message'\n            ), $text\n        );\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PlainTextHandler::loggerOnly\n     * @covers Whoops\\Handler\\PlainTextHandler::handle\n     */\n    public function testReturnsWithLoggerOnlyOutput()\n    {\n        $text = $this->getPlainTextFromHandler(\n            $withTrace = true,\n            $withTraceArgs = true,\n            $traceFunctionArgsOutputLimit = 1024,\n            $loggerOnly = true\n        );\n        // Check that the response has the correct value:\n        $this->assertEquals('', $text);\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PlainTextHandler::loggerOnly\n     * @covers Whoops\\Handler\\PlainTextHandler::handle\n     */\n    public function testGetFrameArgsOutputUsesDumper()\n    {\n        $values = [];\n        $dumper = function ($var) use (&$values) {\n            $values[] = $var;\n        };\n\n        $handler = $this->getHandler();\n        $handler->setDumper($dumper);\n\n        $args = [\n           ['foo', 'bar', 'buz'],\n           [1, 2, 'Fizz', 4, 'Buzz'],\n        ];\n\n        $actual = self::callPrivateMethod($handler, 'dump', [new Frame(['args' => $args[0]])]);\n        $this->assertEquals('', $actual);\n        $this->assertCount(1, $values);\n        $this->assertEquals($args[0], $values[0]->getArgs());\n\n        $actual = self::callPrivateMethod($handler, 'dump', [new Frame(['args' => $args[1]])]);\n        $this->assertEquals('', $actual);\n        $this->assertCount(2, $values);\n        $this->assertEquals($args[1], $values[1]->getArgs());\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/Handler/PrettyPageHandlerTest.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Handler;\n\nuse InvalidArgumentException;\nuse RuntimeException;\nuse Whoops\\TestCase;\n\nclass PrettyPageHandlerTest extends TestCase\n{\n    /**\n     * @return \\Whoops\\Handler\\PrettyPageHandler\n     */\n    private function getHandler()\n    {\n        $handler = new PrettyPageHandler();\n        $handler->handleUnconditionally();\n        return $handler;\n    }\n\n    /**\n     * @return RuntimeException\n     */\n    public function getException()\n    {\n        return new RuntimeException();\n    }\n\n    /**\n     * Test that PrettyPageHandle handles the template without\n     * any errors.\n     * @covers Whoops\\Handler\\PrettyPageHandler::handle\n     */\n    public function testHandleWithoutErrors()\n    {\n        $run     = $this->getRunInstance();\n        $handler = $this->getHandler();\n\n        $run->pushHandler($handler);\n\n        ob_start();\n        $run->handleException($this->getException());\n        ob_get_clean();\n\n        // Reached the end without errors\n        $this->assertTrue(true);\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PrettyPageHandler::setPageTitle\n     * @covers Whoops\\Handler\\PrettyPageHandler::getPageTitle\n     */\n    public function testGetSetPageTitle()\n    {\n        $title = 'My Cool Error Handler';\n        $handler = $this->getHandler();\n        $this->assertEquals($handler, $handler->setPageTitle($title));\n\n        $this->assertEquals($title, $handler->getPagetitle());\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PrettyPageHandler::addResourcePath\n     * @covers Whoops\\Handler\\PrettyPageHandler::getResourcePaths\n     */\n    public function testGetSetResourcePaths()\n    {\n        $path = __DIR__; // guaranteed to be valid!\n        $handler = $this->getHandler();\n\n        $this->assertEquals($handler, $handler->addResourcePath($path));\n        $allPaths = $handler->getResourcePaths();\n\n        $this->assertCount(2, $allPaths);\n        $this->assertEquals($allPaths[0], $path);\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PrettyPageHandler::addResourcePath\n     */\n    public function testSetInvalidResourcesPath()\n    {\n        $this->expectExceptionOfType('InvalidArgumentException');\n\n        $this->getHandler()->addResourcePath(__DIR__ . '/ZIMBABWE');\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PrettyPageHandler::getDataTables\n     * @covers Whoops\\Handler\\PrettyPageHandler::addDataTable\n     */\n    public function testGetSetDataTables()\n    {\n        $handler = $this->getHandler();\n\n        // should have no tables by default:\n        $this->assertEmpty($handler->getDataTables());\n\n        $tableOne = [\n            'ice' => 'cream',\n            'ice-ice' => 'baby',\n        ];\n\n        $tableTwo = [\n            'dolan' => 'pls',\n            'time'  => time(),\n        ];\n\n        $this->assertEquals($handler, $handler->addDataTable('table 1', $tableOne));\n        $this->assertEquals($handler, $handler->addDataTable('table 2', $tableTwo));\n\n        // should contain both tables:\n        $tables = $handler->getDataTables();\n        $this->assertCount(2, $tables);\n\n        $this->assertEquals($tableOne, $tables['table 1']);\n        $this->assertEquals($tableTwo, $tables['table 2']);\n\n        // should contain only table 1\n        $this->assertEquals($tableOne, $handler->getDataTables('table 1'));\n\n        // should return an empty table:\n        $this->assertEmpty($handler->getDataTables('ZIMBABWE!'));\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PrettyPageHandler::getDataTables\n     * @covers Whoops\\Handler\\PrettyPageHandler::addDataTableCallback\n     */\n    public function testSetCallbackDataTables()\n    {\n        $handler = $this->getHandler();\n\n        $this->assertEmpty($handler->getDataTables());\n        $table1 = function () {\n            return [\n                'hammer' => 'time',\n                'foo'    => 'bar',\n            ];\n        };\n        $expected1 = ['hammer' => 'time', 'foo' => 'bar'];\n\n        $table2 = function () use ($expected1) {\n            return [\n                'another' => 'table',\n                'this'    => $expected1,\n            ];\n        };\n        $expected2 = ['another' => 'table', 'this' => $expected1];\n\n        $table3 = function() {\n\t\t\treturn array(\"oh my\" => \"how times have changed!\");\n\t\t};\n        $expected3 = ['oh my' => 'how times have changed!'];\n\n        // Test inspector parameter in data table callback\n        $table4 = function (\\Whoops\\Exception\\Inspector $inspector) {\n            return array(\n              'Exception class' => get_class($inspector->getException()),\n              'Exception message' => $inspector->getExceptionMessage(),\n            );\n        };\n        $expected4 = array(\n          'Exception class' => 'InvalidArgumentException',\n          'Exception message' => 'Test exception message',\n        );\n        $inspectorForTable4 = new \\Whoops\\Exception\\Inspector(\n            new \\InvalidArgumentException('Test exception message')\n        );\n\n        // Sanity check, make sure expected values really are correct.\n        $this->assertSame($expected1, $table1());\n        $this->assertSame($expected2, $table2());\n        $this->assertSame($expected3, $table3());\n        $this->assertSame($expected4, $table4($inspectorForTable4));\n\n        $this->assertEquals($handler, $handler->addDataTableCallback('table1', $table1));\n        $this->assertEquals($handler, $handler->addDataTableCallback('table2', $table2));\n        $this->assertEquals($handler, $handler->addDataTableCallback('table3', $table3));\n        $this->assertEquals($handler, $handler->addDataTableCallback('table4', $table4));\n\n        $tables = $handler->getDataTables();\n        $this->assertCount(4, $tables);\n\n        // Supplied callable is wrapped in a closure\n        $this->assertInstanceOf('Closure', $tables['table1']);\n        $this->assertInstanceOf('Closure', $tables['table2']);\n        $this->assertInstanceOf('Closure', $tables['table3']);\n        $this->assertInstanceOf('Closure', $tables['table4']);\n\n        // Run each wrapped callable and check results against expected output.\n        $this->assertEquals($expected1, $tables['table1']());\n        $this->assertEquals($expected2, $tables['table2']());\n        $this->assertEquals($expected3, $tables['table3']());\n        $this->assertEquals($expected4, $tables['table4']($inspectorForTable4));\n\n        $this->assertSame($tables['table1'], $handler->getDataTables('table1'));\n        $this->assertSame($expected1, call_user_func($handler->getDataTables('table1')));\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PrettyPageHandler::setEditor\n     * @covers Whoops\\Handler\\PrettyPageHandler::getEditorHref\n     */\n    public function testSetEditorSimple()\n    {\n        $handler = $this->getHandler();\n        $this->assertEquals($handler, $handler->setEditor('sublime'));\n\n        $this->assertEquals(\n            $handler->getEditorHref('/foo/bar.php', 10),\n            'subl://open?url=file://%2Ffoo%2Fbar.php&line=10'\n        );\n\n        $this->assertEquals(\n            $handler->getEditorHref('/foo/with space?.php', 2324),\n            'subl://open?url=file://%2Ffoo%2Fwith%20space%3F.php&line=2324'\n        );\n\n        $this->assertEquals(\n            $handler->getEditorHref('/foo/bar/with-dash.php', 0),\n            'subl://open?url=file://%2Ffoo%2Fbar%2Fwith-dash.php&line=0'\n        );\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PrettyPageHandler::setEditor\n     * @covers Whoops\\Handler\\PrettyPageHandler::getEditorHref\n     * @covers Whoops\\Handler\\PrettyPageHandler::getEditorAjax\n     */\n    public function testSetEditorCallable()\n    {\n        $handler = $this->getHandler();\n\n        // Test Callable editor with String return\n        $this->assertEquals($handler, $handler->setEditor(function ($file, $line) {\n            $file = rawurlencode($file);\n            $line = rawurlencode($line);\n            return \"http://google.com/search/?q=$file:$line\";\n        }));\n\n        $this->assertEquals(\n            $handler->getEditorHref('/foo/bar.php', 10),\n            'http://google.com/search/?q=%2Ffoo%2Fbar.php:10'\n        );\n\n        // Then test Callable editor with Array return\n        $this->assertEquals($handler, $handler->setEditor(function ($file, $line) {\n            $file = rawurlencode($file);\n            $line = rawurlencode($line);\n            return [\n                'url' => \"http://google.com/search/?q=$file:$line\",\n                'ajax' => true,\n            ];\n        }));\n\n        $this->assertEquals(\n            $handler->getEditorHref('/foo/bar.php', 10),\n            'http://google.com/search/?q=%2Ffoo%2Fbar.php:10'\n        );\n\n        $this->assertEquals(\n            $handler->getEditorAjax('/foo/bar.php', 10),\n            true\n        );\n\n\n        $this->assertEquals($handler, $handler->setEditor(function ($file, $line) {\n            $file = rawurlencode($file);\n            $line = rawurlencode($line);\n            return [\n                'url' => \"http://google.com/search/?q=$file:$line\",\n                'ajax' => false,\n            ];\n        }));\n\n        $this->assertEquals(\n            $handler->getEditorHref('/foo/bar.php', 10),\n            'http://google.com/search/?q=%2Ffoo%2Fbar.php:10'\n        );\n\n        $this->assertEquals(\n            $handler->getEditorAjax('/foo/bar.php', 10),\n            false\n        );\n\n        $this->assertEquals($handler, $handler->setEditor(function ($file, $line) {\n            return false;\n        }));\n\n        $this->assertEquals(\n            $handler->getEditorHref('/foo/bar.php', 10),\n            false\n        );\n    }\n\n    /**\n     * @covers Whoops\\Handler\\PrettyPageHandler::setEditor\n     * @covers Whoops\\Handler\\PrettyPageHandler::addEditor\n     * @covers Whoops\\Handler\\PrettyPageHandler::getEditorHref\n     */\n    public function testAddEditor()\n    {\n        $handler = $this->getHandler();\n        $this->assertEquals($handler, $handler->addEditor('test-editor',\n                function ($file, $line) {\n            return \"cool beans $file:$line\";\n        }));\n\n        $this->assertEquals($handler, $handler->setEditor('test-editor'));\n\n        $this->assertEquals(\n            $handler->getEditorHref('hello', 20),\n            'cool beans hello:20'\n        );\n    }\n\n    public function testEditorXdebug()\n    {\n        if (!extension_loaded('xdebug')) {\n            // Even though this test only uses ini_set and ini_get,\n            // without xdebug active, those calls do not work.\n            // In particular, ini_get after ini_setting returns false.\n            $this->markTestSkipped('The xdebug extension is not loaded.');\n        }\n\n        $originalValue = ini_get('xdebug.file_link_format');\n\n        ini_set('xdebug.file_link_format', '%f:%l');\n\n        $handler = $this->getHandler();\n        $this->assertEquals($handler, $handler->setEditor('xdebug'));\n\n        $this->assertEquals(\n            '/foo/bar.php:10',\n            $handler->getEditorHref('/foo/bar.php', 10)\n        );\n\n        ini_set('xdebug.file_link_format', 'subl://open?url=%f&line=%l');\n\n        // xdebug doesn't do any URL encoded, matching that behaviour.\n        $this->assertEquals(\n            'subl://open?url=/foo/with space?.php&line=2324',\n            $handler->getEditorHref('/foo/with space?.php', 2324)\n        );\n\n        ini_set('xdebug.file_link_format', $originalValue);\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/Handler/XmlResponseHandlerTest.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n */\n\nnamespace Whoops\\Handler;\n\nuse RuntimeException;\nuse Whoops\\TestCase;\n\nclass XmlResponseHandlerTest extends TestCase\n{\n    public function testSimpleValid()\n    {\n        $handler = new XmlResponseHandler();\n\n        $run = $this->getRunInstance();\n        $run->pushHandler($handler);\n        $run->register();\n\n        ob_start();\n        $run->handleException($this->getException());\n        $data = ob_get_clean();\n\n        $this->assertTrue($this->isValidXml($data));\n\n        return simplexml_load_string($data);\n    }\n\n    /**\n     * @depends testSimpleValid\n     */\n    public function testSimpleValidFile(\\SimpleXMLElement $xml)\n    {\n        $this->checkField($xml, 'file', $this->getException()->getFile());\n    }\n\n    /**\n     * @depends testSimpleValid\n     */\n    public function testSimpleValidLine(\\SimpleXMLElement $xml)\n    {\n        $this->checkField($xml, 'line', (string) $this->getException()->getLine());\n    }\n\n    /**\n     * @depends testSimpleValid\n     */\n    public function testSimpleValidType(\\SimpleXMLElement $xml)\n    {\n        $this->checkField($xml, 'type', get_class($this->getException()));\n    }\n\n    /**\n     * Helper for testSimpleValid*\n     */\n    private function checkField(\\SimpleXMLElement $xml, $field, $value)\n    {\n        $list = $xml->xpath('/root/error/'.$field);\n        $this->assertArrayHasKey(0, $list);\n        $this->assertSame($value, (string) $list[0]);\n    }\n\n    private function getException()\n    {\n        return new RuntimeException();\n    }\n\n    /**\n     * See if passed string is a valid XML document\n     * @param  string $data\n     * @return bool\n     */\n    private function isValidXml($data)\n    {\n        $prev = libxml_use_internal_errors(true);\n        $xml = simplexml_load_string($data);\n        libxml_use_internal_errors($prev);\n        return $xml !== false;\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/RunTest.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops;\n\nuse ArrayObject;\nuse Exception;\nuse InvalidArgumentException;\nuse Mockery as m;\nuse RuntimeException;\nuse Whoops\\Handler\\Handler;\nuse Whoops\\Handler\\HandlerInterface;\nuse Whoops\\Handler\\PrettyPageHandler;\nuse Whoops\\Exception\\Frame;\nuse Whoops\\Util\\SystemFacade;\n\nclass RunTest extends TestCase\n{\n    public function testImplementsRunInterface()\n    {\n        $this->assertNotFalse(class_implements('Whoops\\\\Run', 'Whoops\\\\RunInterface'));\n    }\n\n    public function testConstantsAreAccessibleFromTheClass()\n    {\n        $this->assertEquals(RunInterface::ERROR_HANDLER, Run::ERROR_HANDLER);\n        $this->assertEquals(RunInterface::EXCEPTION_HANDLER, Run::EXCEPTION_HANDLER);\n        $this->assertEquals(RunInterface::SHUTDOWN_HANDLER, Run::SHUTDOWN_HANDLER);\n    }\n\n    /**\n     * @param  string    $message\n     * @return Exception\n     */\n    protected function getException($message = \"\")\n    {\n        // HHVM does not support mocking exceptions\n        // Since we do not use any additional features of Mockery for exceptions,\n        // we can just use native Exceptions instead.\n        return new \\Exception($message);\n    }\n\n    /**\n     * @return Handler\n     */\n    protected function getHandler()\n    {\n        return m::mock('Whoops\\\\Handler\\\\Handler')\n            ->shouldReceive('setRun')\n                ->andReturn(null)\n            ->mock()\n\n            ->shouldReceive('setInspector')\n                ->andReturn(null)\n            ->mock()\n\n            ->shouldReceive('setException')\n                ->andReturn(null)\n            ->mock();\n    }\n\n    /**\n     * @covers Whoops\\Run::clearHandlers\n     */\n    public function testClearHandlers()\n    {\n        $run = $this->getRunInstance();\n        $run->clearHandlers();\n\n        $handlers = $run->getHandlers();\n\n        $this->assertEmpty($handlers);\n    }\n\n    /**\n     * @covers Whoops\\Run::pushHandler\n     */\n    public function testPushHandler()\n    {\n        $run = $this->getRunInstance();\n        $run->clearHandlers();\n\n        $handlerOne = $this->getHandler();\n        $handlerTwo = $this->getHandler();\n\n        $run->pushHandler($handlerOne);\n        $run->pushHandler($handlerTwo);\n\n        $handlers = $run->getHandlers();\n\n        $this->assertCount(2, $handlers);\n        $this->assertContains($handlerOne, $handlers);\n        $this->assertContains($handlerTwo, $handlers);\n    }\n\n    /**\n     * @covers Whoops\\Run::pushHandler\n     */\n    public function testPushInvalidHandler()\n    {\n        $run = $this->getRunInstance();\n\n        $this->expectExceptionOfType('InvalidArgumentException');\n\n        $run->pushHandler('actually turnip');\n    }\n\n    /**\n     * @covers Whoops\\Run::pushHandler\n     */\n    public function testPushClosureBecomesHandler()\n    {\n        $run = $this->getRunInstance();\n        $run->pushHandler(function () {});\n        $this->assertInstanceOf('Whoops\\\\Handler\\\\CallbackHandler', $run->popHandler());\n    }\n\n    /**\n     * @covers Whoops\\Run::popHandler\n     * @covers Whoops\\Run::getHandlers\n     */\n    public function testPopHandler()\n    {\n        $run = $this->getRunInstance();\n\n        $handlerOne   = $this->getHandler();\n        $handlerTwo   = $this->getHandler();\n        $handlerThree = $this->getHandler();\n\n        $run->pushHandler($handlerOne);\n        $run->pushHandler($handlerTwo);\n        $run->pushHandler($handlerThree);\n\n        $this->assertSame($handlerThree, $run->popHandler());\n        $this->assertSame($handlerTwo, $run->popHandler());\n        $this->assertSame($handlerOne, $run->popHandler());\n\n        // Should return null if there's nothing else in\n        // the stack\n        $this->assertNull($run->popHandler());\n\n        // Should be empty since we popped everything off\n        // the stack:\n        $this->assertEmpty($run->getHandlers());\n    }\n\n    /**\n     * @covers Whoops\\Run::removeFirstHandler\n     * @covers Whoops\\Run::removeLastHandler\n     * @covers Whoops\\Run::getHandlers\n     */\n    public function testRemoveHandler()\n    {\n        $run = $this->getRunInstance();\n\n        $handlerOne   = $this->getHandler();\n        $handlerTwo   = $this->getHandler();\n        $handlerThree = $this->getHandler();\n\n        $run->pushHandler($handlerOne);\n        $run->pushHandler($handlerTwo);\n        $run->pushHandler($handlerThree);\n\n        $run->removeLastHandler();\n        $this->assertSame($handlerTwo, $run->getHandlers()[0]);\n        $run->removeFirstHandler();\n        $this->assertSame($handlerTwo, $run->getHandlers()[0]);\n        $this->assertCount(1, $run->getHandlers());\n    }\n\n    /**\n     * @covers Whoops\\Run::register\n     */\n    public function testRegisterHandler()\n    {\n        // It is impossible to test the Run::register method using phpunit,\n        // as given how every test is always inside a giant try/catch block,\n        // any thrown exception will never hit a global exception handler.\n        // On the other hand, there is not much need in testing\n        // a call to a native PHP function.\n        $this->assertTrue(true);\n    }\n\n    /**\n     * @covers Whoops\\Run::unregister\n     */\n    public function testUnregisterHandler()\n    {\n        $run = $this->getRunInstance();\n        $run->register();\n\n        $handler = $this->getHandler();\n        $run->pushHandler($handler);\n\n        $run->unregister();\n\n        $this->expectExceptionOfType('Exception');\n\n        throw $this->getException(\"I'm not supposed to be caught!\");\n    }\n\n    /**\n     * @covers Whoops\\Run::pushHandler\n     * @covers Whoops\\Run::getHandlers\n     */\n    public function testHandlerHoldsOrder()\n    {\n        $run = $this->getRunInstance();\n\n        $handlerOne   = $this->getHandler();\n        $handlerTwo   = $this->getHandler();\n        $handlerThree = $this->getHandler();\n        $handlerFour  = $this->getHandler();\n\n        $run->pushHandler($handlerOne);\n        $run->prependHandler($handlerTwo);\n        $run->appendHandler($handlerThree);\n        $run->appendHandler($handlerFour);\n\n        $handlers = $run->getHandlers();\n\n        $this->assertSame($handlers[0], $handlerFour);\n        $this->assertSame($handlers[1], $handlerThree);\n        $this->assertSame($handlers[2], $handlerOne);\n        $this->assertSame($handlers[3], $handlerTwo);\n    }\n\n    /**\n     * @todo possibly split this up a bit and move\n     *       some of this test to Handler unit tests?\n     * @covers Whoops\\Run::handleException\n     */\n    public function testHandlersGonnaHandle()\n    {\n        $run       = $this->getRunInstance();\n        $exception = $this->getException();\n        $order     = new ArrayObject();\n\n        $handlerOne   = $this->getHandler();\n        $handlerTwo   = $this->getHandler();\n        $handlerThree = $this->getHandler();\n\n        $handlerOne->shouldReceive('handle')\n            ->andReturnUsing(function () use ($order) { $order[] = 1; });\n        $handlerTwo->shouldReceive('handle')\n            ->andReturnUsing(function () use ($order) { $order[] = 2; });\n        $handlerThree->shouldReceive('handle')\n            ->andReturnUsing(function () use ($order) { $order[] = 3; });\n\n        $run->pushHandler($handlerOne);\n        $run->pushHandler($handlerTwo);\n        $run->pushHandler($handlerThree);\n\n        // Get an exception to be handled, and verify that the handlers\n        // are given the handler, and in the inverse order they were\n        // registered.\n        $run->handleException($exception);\n        $this->assertEquals((array) $order, [3, 2, 1]);\n    }\n\n    /**\n     * @covers Whoops\\Run::handleException\n     */\n    public function testLastHandler()\n    {\n        $run = $this->getRunInstance();\n\n        $handlerOne = $this->getHandler();\n        $handlerTwo = $this->getHandler();\n        $handlerThree = $this->getHandler();\n        $handlerFour = $this->getHandler();\n\n        $run->pushHandler($handlerOne);\n        $run->prependHandler($handlerTwo);\n        $run->appendHandler($handlerThree);\n        $run->appendHandler($handlerFour);\n\n        $test = $this;\n        $handlerFour\n            ->shouldReceive('handle')\n            ->andReturnUsing(function () use ($test) {\n                $test->fail('$handlerFour should not be called');\n            });\n\n        $handlerThree\n            ->shouldReceive('handle')\n            ->andReturn(Handler::LAST_HANDLER);\n\n        $twoRan = false;\n\n        $handlerOne\n            ->shouldReceive('handle')\n            ->andReturnUsing(function () use ($test, &$twoRan) {\n                $test->assertTrue($twoRan);\n            });\n\n        $handlerTwo\n            ->shouldReceive('handle')\n            ->andReturnUsing(function () use (&$twoRan) {\n                $twoRan = true;\n            });\n\n        $run->handleException($this->getException());\n\n        // Reached the end without errors\n        $this->assertTrue(true);\n    }\n\n    /**\n     * Test error suppression using @ operator.\n     */\n    public function testErrorSuppression()\n    {\n        $run = $this->getRunInstance();\n        $run->register();\n\n        $handler = $this->getHandler();\n        $run->pushHandler($handler);\n\n        $test = $this;\n        $handler\n            ->shouldReceive('handle')\n            ->andReturnUsing(function () use ($test) {\n                $test->fail('$handler should not be called, error not suppressed');\n            });\n\n        @trigger_error(\"Test error suppression\");\n\n        // Reached the end without errors\n        $this->assertTrue(true);\n    }\n\n    public function testErrorCatching()\n    {\n        $run = $this->getRunInstance();\n        $run->register();\n\n        $handler = $this->getHandler();\n        $run->pushHandler($handler);\n\n        $test = $this;\n        $handler\n            ->shouldReceive('handle')\n            ->andReturnUsing(function () use ($test) {\n                $test->fail('$handler should not be called error should be caught');\n            });\n\n        try {\n            trigger_error('foo', E_USER_NOTICE);\n            $this->fail('Should not continue after error thrown');\n        } catch (\\ErrorException $e) {\n            // Do nothing\n            $this->assertTrue(true);\n            return;\n        }\n        $this->fail('Should not continue here, should have been caught.');\n    }\n\n    /**\n     * Test to make sure that error_reporting is respected.\n     */\n    public function testErrorReporting()\n    {\n        $run = $this->getRunInstance();\n        $run->register();\n\n        $handler = $this->getHandler();\n        $run->pushHandler($handler);\n\n        $test = $this;\n        $handler\n            ->shouldReceive('handle')\n            ->andReturnUsing(function () use ($test) {\n                $test->fail('$handler should not be called, error_reporting not respected');\n            });\n\n        $oldLevel = error_reporting(E_ALL ^ E_USER_NOTICE);\n        trigger_error(\"Test error reporting\", E_USER_NOTICE);\n        error_reporting($oldLevel);\n\n        // Reached the end without errors\n        $this->assertTrue(true);\n    }\n\n    /**\n     * @covers Whoops\\Run::silenceErrorsInPaths\n     */\n    public function testSilenceErrorsInPaths()\n    {\n        $run = $this->getRunInstance();\n        $run->register();\n\n        $handler = $this->getHandler();\n        $run->pushHandler($handler);\n\n        $test = $this;\n        $handler\n            ->shouldReceive('handle')\n            ->andReturnUsing(function () use ($test) {\n                $test->fail('$handler should not be called, silenceErrorsInPaths not respected');\n            });\n\n        $run->silenceErrorsInPaths('@^'.preg_quote(__FILE__, '@').'$@', E_USER_NOTICE);\n        trigger_error('Test', E_USER_NOTICE);\n        $this->assertTrue(true);\n    }\n\n    /**\n     * @covers Whoops\\Run::handleError\n     * @requires PHP < 8\n     */\n    public function testGetSilencedError()\n    {\n        $run = $this->getRunInstance();\n        $run->register();\n\n        $handler = $this->getHandler();\n        $run->pushHandler($handler);\n\n        @strpos();\n\n        $error = error_get_last();\n\n        $this->assertTrue($error && strpos($error['message'], 'strpos()') !== false);\n    }\n\n    /**\n     * @covers Whoops\\Run::handleError\n     * @see https://github.com/filp/whoops/issues/267\n     */\n    public function testErrorWrappedInException()\n    {\n        try {\n            $run = $this->getRunInstance();\n            $run->handleError(E_WARNING, 'my message', 'my file', 99);\n            $this->fail(\"missing expected exception\");\n        } catch (\\ErrorException $e) {\n            $this->assertSame(E_WARNING, $e->getSeverity());\n            $this->assertSame(E_WARNING, $e->getCode(), \"For BC reasons getCode() should match getSeverity()\");\n            $this->assertSame('my message', $e->getMessage());\n            $this->assertSame('my file', $e->getFile());\n            $this->assertSame(99, $e->getLine());\n        }\n    }\n\n    /**\n     * @covers Whoops\\Run::handleException\n     * @covers Whoops\\Run::writeToOutput\n     */\n    public function testOutputIsSent()\n    {\n        $run = $this->getRunInstance();\n        $run->pushHandler(function () {\n            echo \"hello there\";\n        });\n\n        ob_start();\n        $run->handleException(new RuntimeException());\n        $this->assertEquals(\"hello there\", ob_get_clean());\n    }\n\n    /**\n     * @covers Whoops\\Run::handleException\n     * @covers Whoops\\Run::writeToOutput\n     */\n    public function testOutputIsNotSent()\n    {\n        $run = $this->getRunInstance();\n        $run->writeToOutput(false);\n        $run->pushHandler(function () {\n            echo \"hello there\";\n        });\n\n        ob_start();\n        $this->assertEquals(\"hello there\", $run->handleException(new RuntimeException()));\n        $this->assertEquals(\"\", ob_get_clean());\n    }\n\n    /**\n     * @covers Whoops\\Run::sendHttpCode\n     */\n    public function testSendHttpCode()\n    {\n        $run = $this->getRunInstance();\n        $run->sendHttpCode(true);\n        $this->assertEquals(500, $run->sendHttpCode());\n    }\n\n    /**\n     * @covers Whoops\\Run::sendHttpCode\n     */\n    public function testSendHttpCodeNullCode()\n    {\n        $run = $this->getRunInstance();\n        $this->assertEquals(false, $run->sendHttpCode(null));\n    }\n\n    /**\n     * @covers Whoops\\Run::sendHttpCode\n     */\n    public function testSendHttpCodeWrongCode()\n    {\n        $this->expectExceptionOfType('InvalidArgumentException');\n\n        $this->getRunInstance()->sendHttpCode(1337);\n    }\n\n    /**\n     * @covers Whoops\\Run::sendHttpCode\n     */\n    public function testSendExitCode()\n    {\n        $run = $this->getRunInstance();\n        $run->sendExitCode(42);\n        $this->assertEquals(42, $run->sendExitCode());\n    }\n\n    /**\n     * @covers Whoops\\Run::sendExitCode\n     */\n    public function testSendExitCodeDefaultCode()\n    {\n        $run = $this->getRunInstance();\n        $this->assertEquals(1, $run->sendExitCode());\n    }\n\n    /**\n     * @covers Whoops\\Run::sendExitCode\n     */\n    public function testSendExitCodeWrongCode()\n    {\n        $this->expectExceptionOfType('InvalidArgumentException');\n\n        $this->getRunInstance()->sendExitCode(255);\n    }\n\n    /**\n     * @covers Whoops\\Run::addFrameFilter\n     * @covers Whoops\\Run::getFrameFilters\n     */\n    public function testAddFrameFilter()\n    {\n        $run = $this->getRunInstance();\n\n        $filterCallbackOne = function(Frame $frame) {};\n        $filterCallbackTwo = function(Frame $frame) {};\n\n        $run\n            ->addFrameFilter($filterCallbackOne)\n            ->addFrameFilter($filterCallbackTwo);\n\n        $frameFilters = $run->getFrameFilters();\n\n        $this->assertCount(2, $frameFilters);\n        $this->assertContains($filterCallbackOne, $frameFilters);\n        $this->assertContains($filterCallbackTwo, $frameFilters);\n        $this->assertInstanceOf(\"Whoops\\\\RunInterface\", $run);\n    }\n\n    /**\n     * @covers Whoops\\Run::clearFrameFilters\n     * @covers Whoops\\Run::getFrameFilters\n     */\n    public function testClearFrameFilters()\n    {\n        $run = $this->getRunInstance();\n        $run->addFrameFilter(function(Frame $frame) {});\n\n        $run = $run->clearFrameFilters();\n\n        $this->assertEmpty($run->getFrameFilters());\n        $this->assertInstanceOf(\"Whoops\\\\RunInterface\", $run);\n    }\n\n    public function testShutdownHandlerDoesNotRunIfUnregistered()\n    {\n        $system = m::mock('Whoops\\Util\\SystemFacade');\n\n        $run = new Run($system);\n        $run->writeToOutput(false);\n        $run->allowQuit(false);\n\n        $fatalError = [\n            'type'    => E_ERROR,\n            'message' => 'Simulated fatal error for shutdown',\n            'file'    => 'somefile.php',\n            'line'    => 10,\n        ];\n        $system->shouldReceive('getLastError')->andReturn($fatalError)->byDefault();\n\n        $mockHandler = m::mock('Whoops\\Handler\\HandlerInterface');\n        $mockHandler->shouldNotReceive('handle');\n        $mockHandler->shouldNotReceive('setRun');\n        $mockHandler->shouldNotReceive('setInspector');\n        $mockHandler->shouldNotReceive('setException');\n        $run->pushHandler($mockHandler);\n\n        $run->unregister();\n\n        ob_start();\n        $run->handleShutdown();\n        $output = ob_get_clean();\n\n        $this->assertEquals('', $output, \"Output buffer should be empty.\");\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/TestCase.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops;\n\nuse PHPUnit\\Framework\\TestCase as BaseTestCase;\n\nclass TestCase extends BaseTestCase\n{\n    /**\n     * @return Run\n     */\n    protected function getRunInstance()\n    {\n        $run = new Run();\n        $run->allowQuit(false);\n\n        return $run;\n    }\n\n    /**\n     * @param  string $class\n     * @return void\n     */\n    protected function expectExceptionOfType($class)\n    {\n        if (method_exists($this, 'expectException')) {\n            $this->expectException($class);\n        } else {\n            $this->setExpectedException($class);\n        }\n    }\n\n    /**\n     * @param  string $a\n     * @param  string $b\n     * @return void\n     */\n    protected function assertStringContains($a, $b)\n    {\n        if (method_exists($this, 'assertStringContainsString')) {\n            $this->assertStringContainsString($a, $b);\n        } else {\n            $this->assertContains($a, $b);\n        }\n    }\n\n    /**\n     * @param  string $a\n     * @param  string $b\n     * @return void\n     */\n    protected function assertStringNotContains($a, $b)\n    {\n        if (method_exists($this, 'assertStringNotContainsString')) {\n            $this->assertStringNotContainsString($a, $b);\n        } else {\n            $this->assertNotContains($a, $b);\n        }\n    }\n\n    /**\n     * @param  object|string $class_or_object\n     * @param  string        $method\n     * @param  mixed[]       $args\n     * @return mixed\n     */\n    public static function callPrivateMethod($class_or_object, $method, $args = [])\n    {\n        $ref = new \\ReflectionMethod($class_or_object, $method);\n        // setAccessible does not do anything starting with 8.1, throws starting with 8.5\n        if (PHP_VERSION_ID < 80100) {\n            $ref->setAccessible(true);\n        }\n        $object = is_object($class_or_object) ? $class_or_object : null;\n\n        return $ref->invokeArgs($object, $args);\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/Util/HtmlDumperOutputTest.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Util;\n\nuse Whoops\\TestCase;\n\nclass HtmlDumperOutputTest extends TestCase\n{\n    /**\n     * @covers Whoops\\Util::__invoke\n     * @covers Whoops\\Util::getOutput\n     */\n    public function testOutput()\n    {\n        $htmlDumperOutput = new HtmlDumperOutput();\n        $htmlDumperOutput('first line', 0);\n        $htmlDumperOutput('second line', 2);\n\n        $expectedOutput = <<<string\nfirst line\n    second line\n\nstring;\n\n        $this->assertSame($expectedOutput, $htmlDumperOutput->getOutput());\n    }\n\n    /**\n     * @covers Whoops\\Util::clear\n     */\n    public function testClear()\n    {\n        $htmlDumperOutput = new HtmlDumperOutput();\n        $htmlDumperOutput('first line', 0);\n        $htmlDumperOutput('second line', 2);\n        $htmlDumperOutput->clear();\n\n        $this->assertNull($htmlDumperOutput->getOutput());\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/Util/MiscTest.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Util;\n\nuse Whoops\\TestCase;\n\nclass MiscTest extends TestCase\n{\n    /**\n     * @dataProvider provideTranslateException\n     * @param string $expected_output\n     * @param int    $exception_code\n     */\n    public function testTranslateException($expected_output, $exception_code)\n    {\n        $output = Misc::translateErrorCode($exception_code);\n        $this->assertEquals($expected_output, $output);\n    }\n\n    public function provideTranslateException()\n    {\n        return [\n            // When passing an error constant value, ensure the error constant\n            // is returned.\n            ['E_USER_WARNING', E_USER_WARNING],\n\n            // When passing a value not equal to an error constant, ensure\n            // E_UNKNOWN is returned.\n            ['E_UNKNOWN', 3],\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Whoops/Util/SystemFacadeTest.php",
    "content": "<?php\nnamespace Whoops\\Util;\n\nuse PHPUnit\\Framework\\TestCase;\n\nclass SystemFacadeTest extends TestCase\n{\n    /**\n     * @var \\Mockery\\Mock\n     */\n    public static $runtime;\n\n    /**\n     * @var SystemFacade\n     */\n    private $facade;\n\n    public static function delegate($fn, array $args = [])\n    {\n        return self::$runtime\n            ? call_user_func_array([self::$runtime, $fn], $args)\n            : call_user_func_array(\"\\\\$fn\", $args);\n    }\n\n    /**\n     * @before\n     */\n    public function getReady()\n    {\n        self::$runtime = \\Mockery::mock(['ob_start' => true]);\n        $this->facade = new SystemFacade();\n    }\n\n    /**\n     * @after\n     */\n    public function finishUp()\n    {\n        self::$runtime = null;\n        \\Mockery::close();\n    }\n\n    public function test_it_delegates_output_buffering_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('ob_start')->once();\n\n        $this->facade->startOutputBuffering();\n    }\n\n    public function test_it_delegates_cleaning_output_buffering_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('ob_get_clean')->once();\n\n        $this->facade->cleanOutputBuffer();\n    }\n\n    public function test_it_delegates_getting_the_current_buffer_level_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('ob_get_level')->once();\n\n        $this->facade->getOutputBufferLevel();\n    }\n\n    public function test_it_delegates_ending_the_current_buffer_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('ob_end_clean')->once();\n\n        $this->facade->endOutputBuffering();\n    }\n\n    public function test_it_delegates_flushing_the_current_buffer_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('flush')->once();\n\n        $this->facade->flushOutputBuffer();\n    }\n\n    public function test_it_delegates_error_handling_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('set_error_handler')->once();\n\n        $this->facade->setErrorHandler(function(){});\n    }\n\n    public function test_it_delegates_error_handling_with_level_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('set_error_handler')->once();\n\n        $this->facade->setErrorHandler(function(){}, E_CORE_ERROR);\n    }\n\n    public function test_it_delegates_exception_handling_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('set_exception_handler')->once();\n\n        $this->facade->setExceptionHandler(function(){});\n    }\n\n    public function test_it_delegates_restoring_the_exception_handler_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('restore_exception_handler')->once();\n\n        $this->facade->restoreExceptionHandler();\n    }\n\n    public function test_it_delegates_restoring_the_error_handler_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('restore_error_handler')->once();\n\n        $this->facade->restoreErrorHandler();\n    }\n\n    public function test_it_delegates_registering_a_shutdown_function_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('register_shutdown_function')->once();\n\n        $this->facade->registerShutdownFunction(function(){});\n    }\n\n    public function test_it_delegates_error_reporting_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('error_reporting')->once()->withNoArgs();\n\n        $this->facade->getErrorReportingLevel();\n    }\n\n    public function test_it_delegates_getting_the_last_error_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('error_get_last')->once()->withNoArgs();\n\n        $this->facade->getLastError();\n    }\n\n    public function test_it_delegates_sending_an_http_response_code_to_the_native_implementation()\n    {\n        self::$runtime->shouldReceive('headers_sent')->once()->withNoArgs();\n        self::$runtime->shouldReceive('header_remove')->once()->with('location');\n        self::$runtime->shouldReceive('http_response_code')->once()->with(230);\n\n        $this->facade->setHttpResponseCode(230);\n    }\n}\n\nfunction ob_start()\n{\n    return SystemFacadeTest::delegate('ob_start');\n}\n\nfunction ob_get_clean()\n{\n    return SystemFacadeTest::delegate('ob_get_clean');\n}\n\nfunction ob_get_level()\n{\n    return SystemFacadeTest::delegate('ob_get_level');\n}\n\nfunction ob_end_clean()\n{\n    return SystemFacadeTest::delegate('ob_end_clean');\n}\n\nfunction flush()\n{\n    return SystemFacadeTest::delegate('flush');\n}\n\nfunction set_error_handler(callable $handler, $types = 'use-php-defaults')\n{\n    // Workaround for PHP 5.5\n    if ($types === 'use-php-defaults') {\n        $types = E_ALL | E_STRICT;\n    }\n    return SystemFacadeTest::delegate('set_error_handler', func_get_args());\n}\n\nfunction set_exception_handler(callable $handler)\n{\n    return SystemFacadeTest::delegate('set_exception_handler', func_get_args());\n}\n\nfunction restore_exception_handler()\n{\n    return SystemFacadeTest::delegate('restore_exception_handler');\n}\n\nfunction restore_error_handler()\n{\n    return SystemFacadeTest::delegate('restore_error_handler');\n}\n\nfunction register_shutdown_function()\n{\n    return SystemFacadeTest::delegate('register_shutdown_function', func_get_args());\n}\n\nfunction error_reporting($level = null)\n{\n    return SystemFacadeTest::delegate('error_reporting', func_get_args());\n}\n\nfunction error_get_last()\n{\n    return SystemFacadeTest::delegate('error_get_last', func_get_args());\n}\n\nfunction header_remove($header = null)\n{\n    return SystemFacadeTest::delegate('header_remove', func_get_args());\n}\n\nfunction headers_sent(&$filename = null, &$line = null)\n{\n    return SystemFacadeTest::delegate('headers_sent', func_get_args());\n}\n\nfunction http_response_code($code = null)\n{\n    return SystemFacadeTest::delegate('http_response_code', func_get_args());\n}\n"
  },
  {
    "path": "tests/Whoops/Util/TemplateHelperTest.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n */\n\nnamespace Whoops\\Util;\n\nuse Whoops\\TestCase;\n\nclass TemplateHelperTest extends TestCase\n{\n    /**\n     * @var TemplateHelper\n     */\n    private $helper;\n\n    /**\n     * @before\n     */\n    public function getReady()\n    {\n        $this->helper = new TemplateHelper();\n    }\n\n    /**\n     * @covers Whoops\\Util\\TemplateHelper::escapeButPreserveUris\n     * @covers Whoops\\Util\\TemplateHelper::escape\n     */\n    public function testEscape()\n    {\n        $original = \"This is a <a href=''>Foo</a> test string\";\n\n        $this->assertEquals(\n            $this->helper->escape($original),\n            \"This is a &lt;a href=&#039;&#039;&gt;Foo&lt;/a&gt; test string\"\n        );\n    }\n\n    public function testEscapeBrokenUtf8()\n    {\n        // The following includes an illegal utf-8 sequence to test.\n        // Encoded in base64 to survive possible encoding changes of this file.\n        $original = base64_decode('VGhpcyBpcyBhbiBpbGxlZ2FsIHV0Zi04IHNlcXVlbmNlOiDD');\n\n        // Test that the escaped string is kinda similar in length, not empty\n        $this->assertLessThan(\n            10,\n            abs(strlen($original) - strlen($this->helper->escape($original)))\n        );\n    }\n\n    /**\n     * @covers Whoops\\Util\\TemplateHelper::escapeButPreserveUris\n     */\n    public function testEscapeButPreserveUris()\n    {\n        $original = \"This is a <a href=''>http://google.com</a> test string\";\n\n        $this->assertEquals(\n            $this->helper->escapeButPreserveUris($original),\n            \"This is a &lt;a href=&#039;&#039;&gt;<a href=\\\"http://google.com\\\" target=\\\"_blank\\\" rel=\\\"noreferrer noopener\\\">http://google.com</a>&lt;/a&gt; test string\"\n        );\n    }\n\n    /**\n     * @covers Whoops\\Util\\TemplateHelper::breakOnDelimiter\n     */\n    public function testBreakOnDelimiter()\n    {\n        $this->assertSame(\n            '<span class=\"delimiter\">abc</span>-<span class=\"delimiter\">123</span>-<span class=\"delimiter\">456</span>',\n            $this->helper->breakOnDelimiter('-', 'abc-123-456')\n        );\n    }\n\n    /**\n     * @covers Whoops\\Util\\TemplateHelper::shorten\n     */\n    public function testShorten()\n    {\n        $path = '/foo/bar/baz/abc.def';\n\n        $this->assertSame($path, $this->helper->shorten($path));\n\n        $this->helper->setApplicationRootPath('/foo/bar');\n        $this->assertSame('&hellip;/baz/abc.def', $this->helper->shorten($path));\n    }\n\n    /**\n     * @covers Whoops\\Util\\TemplateHelper::slug\n     */\n    public function testSlug()\n    {\n        $this->assertEquals(\"hello-world\", $this->helper->slug(\"Hello, world!\"));\n        $this->assertEquals(\"potato-class\", $this->helper->slug(\"Potato class\"));\n    }\n\n    /**\n     * @covers Whoops\\Util\\TemplateHelper::render\n     */\n    public function testRender()\n    {\n        $template = __DIR__ . \"/../../fixtures/template.php\";\n\n        ob_start();\n        $this->helper->render($template, [\"name\" => \"B<o>b\"]);\n        $output = ob_get_clean();\n\n        $this->assertEquals(\n            $output,\n            \"hello-world\\nMy name is B&lt;o&gt;b\"\n        );\n    }\n\n    /**\n     * @covers Whoops\\Util\\TemplateHelper::setVariables\n     * @covers Whoops\\Util\\TemplateHelper::getVariables\n     * @covers Whoops\\Util\\TemplateHelper::setVariable\n     * @covers Whoops\\Util\\TemplateHelper::getVariable\n     * @covers Whoops\\Util\\TemplateHelper::delVariable\n     */\n    public function testTemplateVariables()\n    {\n        $this->helper->setVariables([\n            \"name\" => \"Whoops\",\n            \"type\" => \"library\",\n            \"desc\" => \"php errors for cool kids\",\n        ]);\n\n        $this->helper->setVariable(\"name\", \"Whoops!\");\n        $this->assertEquals($this->helper->getVariable(\"name\"), \"Whoops!\");\n        $this->helper->delVariable(\"type\");\n\n        $this->assertEquals($this->helper->getVariables(), [\n            \"name\" => \"Whoops!\",\n            \"desc\" => \"php errors for cool kids\",\n        ]);\n    }\n}\n"
  },
  {
    "path": "tests/bootstrap.php",
    "content": "<?php\n/**\n * Whoops - php errors for cool kids\n * @author Filipe Dobreira <http://github.com/filp>\n *\n * Bootstrapper for PHPUnit tests.\n */\nerror_reporting(E_ALL);\n\nrequire_once __DIR__ . '/../vendor/autoload.php';\n"
  },
  {
    "path": "tests/fixtures/frame.lines-test.php",
    "content": "<?php\n// Line 2\n// Line 3\n// Line 4\n// Line 5\n// Line 6\n// Line 7\n// Line 8\n// Line 9\n// Line 10\n"
  },
  {
    "path": "tests/fixtures/template.php",
    "content": "<?php echo $tpl->slug(\"hello world!\"); ?>\n\nMy name is <?php echo $tpl->escape($name) ?>\n"
  }
]