= t('The server address must use this format: "tcp://hostname:5222"') ?>
+= t('Help on Jabber integration') ?>
+= t('Help on how to generate a bot') ?>
+ = $this->form->hidden('forward_attachments', array('forward_attachments' => 0)) ?> + = $this->form->checkbox('forward_attachments', t('Sent attachments along with notification'), 1, isset($values['forward_attachments']) && $values['forward_attachments'] == 1) ?> += t('Help on Jabber integration') ?>
- -
+ = t('Telegram bot is not configured in Kanboard settings.') ?>
+ = t('Go to ')?> = t('Settings > Integrations > Telegram')?> = t(' and fill the form:')?>
+ = t('Telegram bot username: Username of your Telegram Bot') ?>
+ = t('Telegram bot API key: HTTP API token generated by BotFather after bot creation') ?>
+
+ = t('To get your Telegram chat id,')?>
+ = t('1. Send the message %s to',$random )?> = $bot_url ?>
+ = t('2. Press')?>= $this->modal->medium('none', t('Get chat id'), 'TelegramController', 'get_project_chat_id',array('plugin' => 'Telegram', 'private_message' => $random,'project_id' => $project['id'] ) ) ?>
+
= t('Message %s not found!', $private_message) ?>
+= t('Please send message %s ', $private_message) ?>
+ to = $bot_url ?>
If you wish connect the bot to chat room, please ensure that the bot have admin rights!
++ = t('Save chat id="%s" from "%s"?', $this->text->e($chat_id), $this->text->e($user_name)) ?> +
+ + = $this->modal->confirmButtons( + 'TelegramController', + 'save_project_chat_id', + array('plugin' => 'Telegram','project_id' => $project['id'], 'chat_id' => $chat_id) + ) ?> += t('Help on Jabber integration') ?>
- -
+ = t('Telegram bot is not configured in Kanboard settings.') ?>
+ = t('Go to ')?> = t('Settings > Integrations > Telegram')?> = t(' and fill the form:')?>
+ = t('Telegram bot username: Username of your Telegram Bot') ?>
+ = t('Telegram bot API key: HTTP API token generated by BotFather after bot creation') ?>
+
+ = t('To get your Telegram chat id,')?>
+ = t('1. Send the message %s to',$random )?> = $bot_url ?>
+ = t('2. Press')?>= $this->modal->medium('none', t('Get chat id'), 'TelegramController', 'get_user_chat_id',array('plugin' => 'Telegram', 'private_message' => $random )) ?>
+
= t('Message %s not found!', $private_message) ?>
+= t('Please send message %s ', $private_message) ?>
+ to = $bot_url ?>
If you wish connect the bot to chat room, please ensure that the bot have admin rights!
++ = t('Save chat id="%s" from "%s"?', $this->text->e($chat_id), $this->text->e($user_name)) ?> +
+ + = $this->modal->confirmButtons( + 'TelegramController', + 'save_user_chat_id', + array('plugin' => 'Telegram', 'chat_id' => $chat_id) + ) ?> +sprintf
- *
- * @param string $message
- * @param mixed $args
- * @param mixed $...
- * @return string
- */
- public static function quoteMessage($message)
- {
- $variables = func_get_args();
-
- // shift message variable
- array_shift($variables);
-
- // workaround for `static` call in a closure
- $class = __CLASS__;
-
- return vsprintf(
- $message,
- array_map(
- function ($var) use ($class) {
- return $class::quote($var);
- },
- $variables
- )
- );
- }
-
- /**
- * Generate a unique id.
- *
- * @return string
- */
- public static function generateId()
- {
- return static::quote('fabiang_xmpp_' . uniqid());
- }
-
- /**
- * Encode a string with Base64 and quote it.
- *
- * @param string $data
- * @param string $encoding
- * @return string
- */
- public static function base64Encode($data, $encoding = 'UTF-8')
- {
- return static::quote(base64_encode($data), $encoding);
- }
-
- /**
- * Decode a Base64 encoded string.
- *
- * @param string $data
- * @return string
- */
- public static function base64Decode($data)
- {
- return base64_decode($data);
- }
-}
diff --git a/vendor/guzzlehttp/guzzle/CHANGELOG.md b/vendor/guzzlehttp/guzzle/CHANGELOG.md
new file mode 100644
index 0000000..b265cbc
--- /dev/null
+++ b/vendor/guzzlehttp/guzzle/CHANGELOG.md
@@ -0,0 +1,1264 @@
+# CHANGELOG
+
+## 6.3.0 - 2017-06-22
+
+* Feature: force IP resolution (ipv4 or ipv6) [#1608](https://github.com/guzzle/guzzle/pull/1608), [#1659](https://github.com/guzzle/guzzle/pull/1659)
+* Improvement: Don't include summary in exception message when body is empty [#1621](https://github.com/guzzle/guzzle/pull/1621)
+* Improvement: Handle `on_headers` option in MockHandler [#1580](https://github.com/guzzle/guzzle/pull/1580)
+* Improvement: Added SUSE Linux CA path [#1609](https://github.com/guzzle/guzzle/issues/1609)
+* Improvement: Use class reference for getting the name of the class instead of using hardcoded strings [#1641](https://github.com/guzzle/guzzle/pull/1641)
+* Feature: Added `read_timeout` option [#1611](https://github.com/guzzle/guzzle/pull/1611)
+* Bug fix: PHP 7.x fixes [#1685](https://github.com/guzzle/guzzle/pull/1685), [#1686](https://github.com/guzzle/guzzle/pull/1686), [#1811](https://github.com/guzzle/guzzle/pull/1811)
+* Deprecation: BadResponseException instantiation without a response [#1642](https://github.com/guzzle/guzzle/pull/1642)
+* Feature: Added NTLM auth [#1569](https://github.com/guzzle/guzzle/pull/1569)
+* Feature: Track redirect HTTP status codes [#1711](https://github.com/guzzle/guzzle/pull/1711)
+* Improvement: Check handler type during construction [#1745](https://github.com/guzzle/guzzle/pull/1745)
+* Improvement: Always include the Content-Length if there's a body [#1721](https://github.com/guzzle/guzzle/pull/1721)
+* Feature: Added convenience method to access a cookie by name [#1318](https://github.com/guzzle/guzzle/pull/1318)
+* Bug fix: Fill `CURLOPT_CAPATH` and `CURLOPT_CAINFO` properly [#1684](https://github.com/guzzle/guzzle/pull/1684)
+* Improvement: Use `\GuzzleHttp\Promise\rejection_for` function instead of object init [#1827](https://github.com/guzzle/guzzle/pull/1827)
+
+
++ Minor code cleanups, documentation fixes and clarifications.
+
+## 6.2.3 - 2017-02-28
+
+* Fix deprecations with guzzle/psr7 version 1.4
+
+## 6.2.2 - 2016-10-08
+
+* Allow to pass nullable Response to delay callable
+* Only add scheme when host is present
+* Fix drain case where content-length is the literal string zero
+* Obfuscate in-URL credentials in exceptions
+
+## 6.2.1 - 2016-07-18
+
+* Address HTTP_PROXY security vulnerability, CVE-2016-5385:
+ https://httpoxy.org/
+* Fixing timeout bug with StreamHandler:
+ https://github.com/guzzle/guzzle/pull/1488
+* Only read up to `Content-Length` in PHP StreamHandler to avoid timeouts when
+ a server does not honor `Connection: close`.
+* Ignore URI fragment when sending requests.
+
+## 6.2.0 - 2016-03-21
+
+* Feature: added `GuzzleHttp\json_encode` and `GuzzleHttp\json_decode`.
+ https://github.com/guzzle/guzzle/pull/1389
+* Bug fix: Fix sleep calculation when waiting for delayed requests.
+ https://github.com/guzzle/guzzle/pull/1324
+* Feature: More flexible history containers.
+ https://github.com/guzzle/guzzle/pull/1373
+* Bug fix: defer sink stream opening in StreamHandler.
+ https://github.com/guzzle/guzzle/pull/1377
+* Bug fix: do not attempt to escape cookie values.
+ https://github.com/guzzle/guzzle/pull/1406
+* Feature: report original content encoding and length on decoded responses.
+ https://github.com/guzzle/guzzle/pull/1409
+* Bug fix: rewind seekable request bodies before dispatching to cURL.
+ https://github.com/guzzle/guzzle/pull/1422
+* Bug fix: provide an empty string to `http_build_query` for HHVM workaround.
+ https://github.com/guzzle/guzzle/pull/1367
+
+## 6.1.1 - 2015-11-22
+
+* Bug fix: Proxy::wrapSync() now correctly proxies to the appropriate handler
+ https://github.com/guzzle/guzzle/commit/911bcbc8b434adce64e223a6d1d14e9a8f63e4e4
+* Feature: HandlerStack is now more generic.
+ https://github.com/guzzle/guzzle/commit/f2102941331cda544745eedd97fc8fd46e1ee33e
+* Bug fix: setting verify to false in the StreamHandler now disables peer
+ verification. https://github.com/guzzle/guzzle/issues/1256
+* Feature: Middleware now uses an exception factory, including more error
+ context. https://github.com/guzzle/guzzle/pull/1282
+* Feature: better support for disabled functions.
+ https://github.com/guzzle/guzzle/pull/1287
+* Bug fix: fixed regression where MockHandler was not using `sink`.
+ https://github.com/guzzle/guzzle/pull/1292
+
+## 6.1.0 - 2015-09-08
+
+* Feature: Added the `on_stats` request option to provide access to transfer
+ statistics for requests. https://github.com/guzzle/guzzle/pull/1202
+* Feature: Added the ability to persist session cookies in CookieJars.
+ https://github.com/guzzle/guzzle/pull/1195
+* Feature: Some compatibility updates for Google APP Engine
+ https://github.com/guzzle/guzzle/pull/1216
+* Feature: Added support for NO_PROXY to prevent the use of a proxy based on
+ a simple set of rules. https://github.com/guzzle/guzzle/pull/1197
+* Feature: Cookies can now contain square brackets.
+ https://github.com/guzzle/guzzle/pull/1237
+* Bug fix: Now correctly parsing `=` inside of quotes in Cookies.
+ https://github.com/guzzle/guzzle/pull/1232
+* Bug fix: Cusotm cURL options now correctly override curl options of the
+ same name. https://github.com/guzzle/guzzle/pull/1221
+* Bug fix: Content-Type header is now added when using an explicitly provided
+ multipart body. https://github.com/guzzle/guzzle/pull/1218
+* Bug fix: Now ignoring Set-Cookie headers that have no name.
+* Bug fix: Reason phrase is no longer cast to an int in some cases in the
+ cURL handler. https://github.com/guzzle/guzzle/pull/1187
+* Bug fix: Remove the Authorization header when redirecting if the Host
+ header changes. https://github.com/guzzle/guzzle/pull/1207
+* Bug fix: Cookie path matching fixes
+ https://github.com/guzzle/guzzle/issues/1129
+* Bug fix: Fixing the cURL `body_as_string` setting
+ https://github.com/guzzle/guzzle/pull/1201
+* Bug fix: quotes are no longer stripped when parsing cookies.
+ https://github.com/guzzle/guzzle/issues/1172
+* Bug fix: `form_params` and `query` now always uses the `&` separator.
+ https://github.com/guzzle/guzzle/pull/1163
+* Bug fix: Adding a Content-Length to PHP stream wrapper requests if not set.
+ https://github.com/guzzle/guzzle/pull/1189
+
+## 6.0.2 - 2015-07-04
+
+* Fixed a memory leak in the curl handlers in which references to callbacks
+ were not being removed by `curl_reset`.
+* Cookies are now extracted properly before redirects.
+* Cookies now allow more character ranges.
+* Decoded Content-Encoding responses are now modified to correctly reflect
+ their state if the encoding was automatically removed by a handler. This
+ means that the `Content-Encoding` header may be removed an the
+ `Content-Length` modified to reflect the message size after removing the
+ encoding.
+* Added a more explicit error message when trying to use `form_params` and
+ `multipart` in the same request.
+* Several fixes for HHVM support.
+* Functions are now conditionally required using an additional level of
+ indirection to help with global Composer installations.
+
+## 6.0.1 - 2015-05-27
+
+* Fixed a bug with serializing the `query` request option where the `&`
+ separator was missing.
+* Added a better error message for when `body` is provided as an array. Please
+ use `form_params` or `multipart` instead.
+* Various doc fixes.
+
+## 6.0.0 - 2015-05-26
+
+* See the UPGRADING.md document for more information.
+* Added `multipart` and `form_params` request options.
+* Added `synchronous` request option.
+* Added the `on_headers` request option.
+* Fixed `expect` handling.
+* No longer adding default middlewares in the client ctor. These need to be
+ present on the provided handler in order to work.
+* Requests are no longer initiated when sending async requests with the
+ CurlMultiHandler. This prevents unexpected recursion from requests completing
+ while ticking the cURL loop.
+* Removed the semantics of setting `default` to `true`. This is no longer
+ required now that the cURL loop is not ticked for async requests.
+* Added request and response logging middleware.
+* No longer allowing self signed certificates when using the StreamHandler.
+* Ensuring that `sink` is valid if saving to a file.
+* Request exceptions now include a "handler context" which provides handler
+ specific contextual information.
+* Added `GuzzleHttp\RequestOptions` to allow request options to be applied
+ using constants.
+* `$maxHandles` has been removed from CurlMultiHandler.
+* `MultipartPostBody` is now part of the `guzzlehttp/psr7` package.
+
+## 5.3.0 - 2015-05-19
+
+* Mock now supports `save_to`
+* Marked `AbstractRequestEvent::getTransaction()` as public.
+* Fixed a bug in which multiple headers using different casing would overwrite
+ previous headers in the associative array.
+* Added `Utils::getDefaultHandler()`
+* Marked `GuzzleHttp\Client::getDefaultUserAgent` as deprecated.
+* URL scheme is now always lowercased.
+
+## 6.0.0-beta.1
+
+* Requires PHP >= 5.5
+* Updated to use PSR-7
+ * Requires immutable messages, which basically means an event based system
+ owned by a request instance is no longer possible.
+ * Utilizing the [Guzzle PSR-7 package](https://github.com/guzzle/psr7).
+ * Removed the dependency on `guzzlehttp/streams`. These stream abstractions
+ are available in the `guzzlehttp/psr7` package under the `GuzzleHttp\Psr7`
+ namespace.
+* Added middleware and handler system
+ * Replaced the Guzzle event and subscriber system with a middleware system.
+ * No longer depends on RingPHP, but rather places the HTTP handlers directly
+ in Guzzle, operating on PSR-7 messages.
+ * Retry logic is now encapsulated in `GuzzleHttp\Middleware::retry`, which
+ means the `guzzlehttp/retry-subscriber` is now obsolete.
+ * Mocking responses is now handled using `GuzzleHttp\Handler\MockHandler`.
+* Asynchronous responses
+ * No longer supports the `future` request option to send an async request.
+ Instead, use one of the `*Async` methods of a client (e.g., `requestAsync`,
+ `getAsync`, etc.).
+ * Utilizing `GuzzleHttp\Promise` instead of React's promise library to avoid
+ recursion required by chaining and forwarding react promises. See
+ https://github.com/guzzle/promises
+ * Added `requestAsync` and `sendAsync` to send request asynchronously.
+ * Added magic methods for `getAsync()`, `postAsync()`, etc. to send requests
+ asynchronously.
+* Request options
+ * POST and form updates
+ * Added the `form_fields` and `form_files` request options.
+ * Removed the `GuzzleHttp\Post` namespace.
+ * The `body` request option no longer accepts an array for POST requests.
+ * The `exceptions` request option has been deprecated in favor of the
+ `http_errors` request options.
+ * The `save_to` request option has been deprecated in favor of `sink` request
+ option.
+* Clients no longer accept an array of URI template string and variables for
+ URI variables. You will need to expand URI templates before passing them
+ into a client constructor or request method.
+* Client methods `get()`, `post()`, `put()`, `patch()`, `options()`, etc. are
+ now magic methods that will send synchronous requests.
+* Replaced `Utils.php` with plain functions in `functions.php`.
+* Removed `GuzzleHttp\Collection`.
+* Removed `GuzzleHttp\BatchResults`. Batched pool results are now returned as
+ an array.
+* Removed `GuzzleHttp\Query`. Query string handling is now handled using an
+ associative array passed into the `query` request option. The query string
+ is serialized using PHP's `http_build_query`. If you need more control, you
+ can pass the query string in as a string.
+* `GuzzleHttp\QueryParser` has been replaced with the
+ `GuzzleHttp\Psr7\parse_query`.
+
+## 5.2.0 - 2015-01-27
+
+* Added `AppliesHeadersInterface` to make applying headers to a request based
+ on the body more generic and not specific to `PostBodyInterface`.
+* Reduced the number of stack frames needed to send requests.
+* Nested futures are now resolved in the client rather than the RequestFsm
+* Finishing state transitions is now handled in the RequestFsm rather than the
+ RingBridge.
+* Added a guard in the Pool class to not use recursion for request retries.
+
+## 5.1.0 - 2014-12-19
+
+* Pool class no longer uses recursion when a request is intercepted.
+* The size of a Pool can now be dynamically adjusted using a callback.
+ See https://github.com/guzzle/guzzle/pull/943.
+* Setting a request option to `null` when creating a request with a client will
+ ensure that the option is not set. This allows you to overwrite default
+ request options on a per-request basis.
+ See https://github.com/guzzle/guzzle/pull/937.
+* Added the ability to limit which protocols are allowed for redirects by
+ specifying a `protocols` array in the `allow_redirects` request option.
+* Nested futures due to retries are now resolved when waiting for synchronous
+ responses. See https://github.com/guzzle/guzzle/pull/947.
+* `"0"` is now an allowed URI path. See
+ https://github.com/guzzle/guzzle/pull/935.
+* `Query` no longer typehints on the `$query` argument in the constructor,
+ allowing for strings and arrays.
+* Exceptions thrown in the `end` event are now correctly wrapped with Guzzle
+ specific exceptions if necessary.
+
+## 5.0.3 - 2014-11-03
+
+This change updates query strings so that they are treated as un-encoded values
+by default where the value represents an un-encoded value to send over the
+wire. A Query object then encodes the value before sending over the wire. This
+means that even value query string values (e.g., ":") are url encoded. This
+makes the Query class match PHP's http_build_query function. However, if you
+want to send requests over the wire using valid query string characters that do
+not need to be encoded, then you can provide a string to Url::setQuery() and
+pass true as the second argument to specify that the query string is a raw
+string that should not be parsed or encoded (unless a call to getQuery() is
+subsequently made, forcing the query-string to be converted into a Query
+object).
+
+## 5.0.2 - 2014-10-30
+
+* Added a trailing `\r\n` to multipart/form-data payloads. See
+ https://github.com/guzzle/guzzle/pull/871
+* Added a `GuzzleHttp\Pool::send()` convenience method to match the docs.
+* Status codes are now returned as integers. See
+ https://github.com/guzzle/guzzle/issues/881
+* No longer overwriting an existing `application/x-www-form-urlencoded` header
+ when sending POST requests, allowing for customized headers. See
+ https://github.com/guzzle/guzzle/issues/877
+* Improved path URL serialization.
+
+ * No longer double percent-encoding characters in the path or query string if
+ they are already encoded.
+ * Now properly encoding the supplied path to a URL object, instead of only
+ encoding ' ' and '?'.
+ * Note: This has been changed in 5.0.3 to now encode query string values by
+ default unless the `rawString` argument is provided when setting the query
+ string on a URL: Now allowing many more characters to be present in the
+ query string without being percent encoded. See http://tools.ietf.org/html/rfc3986#appendix-A
+
+## 5.0.1 - 2014-10-16
+
+Bugfix release.
+
+* Fixed an issue where connection errors still returned response object in
+ error and end events event though the response is unusable. This has been
+ corrected so that a response is not returned in the `getResponse` method of
+ these events if the response did not complete. https://github.com/guzzle/guzzle/issues/867
+* Fixed an issue where transfer statistics were not being populated in the
+ RingBridge. https://github.com/guzzle/guzzle/issues/866
+
+## 5.0.0 - 2014-10-12
+
+Adding support for non-blocking responses and some minor API cleanup.
+
+### New Features
+
+* Added support for non-blocking responses based on `guzzlehttp/guzzle-ring`.
+* Added a public API for creating a default HTTP adapter.
+* Updated the redirect plugin to be non-blocking so that redirects are sent
+ concurrently. Other plugins like this can now be updated to be non-blocking.
+* Added a "progress" event so that you can get upload and download progress
+ events.
+* Added `GuzzleHttp\Pool` which implements FutureInterface and transfers
+ requests concurrently using a capped pool size as efficiently as possible.
+* Added `hasListeners()` to EmitterInterface.
+* Removed `GuzzleHttp\ClientInterface::sendAll` and marked
+ `GuzzleHttp\Client::sendAll` as deprecated (it's still there, just not the
+ recommended way).
+
+### Breaking changes
+
+The breaking changes in this release are relatively minor. The biggest thing to
+look out for is that request and response objects no longer implement fluent
+interfaces.
+
+* Removed the fluent interfaces (i.e., `return $this`) from requests,
+ responses, `GuzzleHttp\Collection`, `GuzzleHttp\Url`,
+ `GuzzleHttp\Query`, `GuzzleHttp\Post\PostBody`, and
+ `GuzzleHttp\Cookie\SetCookie`. This blog post provides a good outline of
+ why I did this: http://ocramius.github.io/blog/fluent-interfaces-are-evil/.
+ This also makes the Guzzle message interfaces compatible with the current
+ PSR-7 message proposal.
+* Removed "functions.php", so that Guzzle is truly PSR-4 compliant. Except
+ for the HTTP request functions from function.php, these functions are now
+ implemented in `GuzzleHttp\Utils` using camelCase. `GuzzleHttp\json_decode`
+ moved to `GuzzleHttp\Utils::jsonDecode`. `GuzzleHttp\get_path` moved to
+ `GuzzleHttp\Utils::getPath`. `GuzzleHttp\set_path` moved to
+ `GuzzleHttp\Utils::setPath`. `GuzzleHttp\batch` should now be
+ `GuzzleHttp\Pool::batch`, which returns an `objectStorage`. Using functions.php
+ caused problems for many users: they aren't PSR-4 compliant, require an
+ explicit include, and needed an if-guard to ensure that the functions are not
+ declared multiple times.
+* Rewrote adapter layer.
+ * Removing all classes from `GuzzleHttp\Adapter`, these are now
+ implemented as callables that are stored in `GuzzleHttp\Ring\Client`.
+ * Removed the concept of "parallel adapters". Sending requests serially or
+ concurrently is now handled using a single adapter.
+ * Moved `GuzzleHttp\Adapter\Transaction` to `GuzzleHttp\Transaction`. The
+ Transaction object now exposes the request, response, and client as public
+ properties. The getters and setters have been removed.
+* Removed the "headers" event. This event was only useful for changing the
+ body a response once the headers of the response were known. You can implement
+ a similar behavior in a number of ways. One example might be to use a
+ FnStream that has access to the transaction being sent. For example, when the
+ first byte is written, you could check if the response headers match your
+ expectations, and if so, change the actual stream body that is being
+ written to.
+* Removed the `asArray` parameter from
+ `GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header
+ value as an array, then use the newly added `getHeaderAsArray()` method of
+ `MessageInterface`. This change makes the Guzzle interfaces compatible with
+ the PSR-7 interfaces.
+* `GuzzleHttp\Message\MessageFactory` no longer allows subclasses to add
+ custom request options using double-dispatch (this was an implementation
+ detail). Instead, you should now provide an associative array to the
+ constructor which is a mapping of the request option name mapping to a
+ function that applies the option value to a request.
+* Removed the concept of "throwImmediately" from exceptions and error events.
+ This control mechanism was used to stop a transfer of concurrent requests
+ from completing. This can now be handled by throwing the exception or by
+ cancelling a pool of requests or each outstanding future request individually.
+* Updated to "GuzzleHttp\Streams" 3.0.
+ * `GuzzleHttp\Stream\StreamInterface::getContents()` no longer accepts a
+ `maxLen` parameter. This update makes the Guzzle streams project
+ compatible with the current PSR-7 proposal.
+ * `GuzzleHttp\Stream\Stream::__construct`,
+ `GuzzleHttp\Stream\Stream::factory`, and
+ `GuzzleHttp\Stream\Utils::create` no longer accept a size in the second
+ argument. They now accept an associative array of options, including the
+ "size" key and "metadata" key which can be used to provide custom metadata.
+
+## 4.2.2 - 2014-09-08
+
+* Fixed a memory leak in the CurlAdapter when reusing cURL handles.
+* No longer using `request_fulluri` in stream adapter proxies.
+* Relative redirects are now based on the last response, not the first response.
+
+## 4.2.1 - 2014-08-19
+
+* Ensuring that the StreamAdapter does not always add a Content-Type header
+* Adding automated github releases with a phar and zip
+
+## 4.2.0 - 2014-08-17
+
+* Now merging in default options using a case-insensitive comparison.
+ Closes https://github.com/guzzle/guzzle/issues/767
+* Added the ability to automatically decode `Content-Encoding` response bodies
+ using the `decode_content` request option. This is set to `true` by default
+ to decode the response body if it comes over the wire with a
+ `Content-Encoding`. Set this value to `false` to disable decoding the
+ response content, and pass a string to provide a request `Accept-Encoding`
+ header and turn on automatic response decoding. This feature now allows you
+ to pass an `Accept-Encoding` header in the headers of a request but still
+ disable automatic response decoding.
+ Closes https://github.com/guzzle/guzzle/issues/764
+* Added the ability to throw an exception immediately when transferring
+ requests in parallel. Closes https://github.com/guzzle/guzzle/issues/760
+* Updating guzzlehttp/streams dependency to ~2.1
+* No longer utilizing the now deprecated namespaced methods from the stream
+ package.
+
+## 4.1.8 - 2014-08-14
+
+* Fixed an issue in the CurlFactory that caused setting the `stream=false`
+ request option to throw an exception.
+ See: https://github.com/guzzle/guzzle/issues/769
+* TransactionIterator now calls rewind on the inner iterator.
+ See: https://github.com/guzzle/guzzle/pull/765
+* You can now set the `Content-Type` header to `multipart/form-data`
+ when creating POST requests to force multipart bodies.
+ See https://github.com/guzzle/guzzle/issues/768
+
+## 4.1.7 - 2014-08-07
+
+* Fixed an error in the HistoryPlugin that caused the same request and response
+ to be logged multiple times when an HTTP protocol error occurs.
+* Ensuring that cURL does not add a default Content-Type when no Content-Type
+ has been supplied by the user. This prevents the adapter layer from modifying
+ the request that is sent over the wire after any listeners may have already
+ put the request in a desired state (e.g., signed the request).
+* Throwing an exception when you attempt to send requests that have the
+ "stream" set to true in parallel using the MultiAdapter.
+* Only calling curl_multi_select when there are active cURL handles. This was
+ previously changed and caused performance problems on some systems due to PHP
+ always selecting until the maximum select timeout.
+* Fixed a bug where multipart/form-data POST fields were not correctly
+ aggregated (e.g., values with "&").
+
+## 4.1.6 - 2014-08-03
+
+* Added helper methods to make it easier to represent messages as strings,
+ including getting the start line and getting headers as a string.
+
+## 4.1.5 - 2014-08-02
+
+* Automatically retrying cURL "Connection died, retrying a fresh connect"
+ errors when possible.
+* cURL implementation cleanup
+* Allowing multiple event subscriber listeners to be registered per event by
+ passing an array of arrays of listener configuration.
+
+## 4.1.4 - 2014-07-22
+
+* Fixed a bug that caused multi-part POST requests with more than one field to
+ serialize incorrectly.
+* Paths can now be set to "0"
+* `ResponseInterface::xml` now accepts a `libxml_options` option and added a
+ missing default argument that was required when parsing XML response bodies.
+* A `save_to` stream is now created lazily, which means that files are not
+ created on disk unless a request succeeds.
+
+## 4.1.3 - 2014-07-15
+
+* Various fixes to multipart/form-data POST uploads
+* Wrapping function.php in an if-statement to ensure Guzzle can be used
+ globally and in a Composer install
+* Fixed an issue with generating and merging in events to an event array
+* POST headers are only applied before sending a request to allow you to change
+ the query aggregator used before uploading
+* Added much more robust query string parsing
+* Fixed various parsing and normalization issues with URLs
+* Fixing an issue where multi-valued headers were not being utilized correctly
+ in the StreamAdapter
+
+## 4.1.2 - 2014-06-18
+
+* Added support for sending payloads with GET requests
+
+## 4.1.1 - 2014-06-08
+
+* Fixed an issue related to using custom message factory options in subclasses
+* Fixed an issue with nested form fields in a multi-part POST
+* Fixed an issue with using the `json` request option for POST requests
+* Added `ToArrayInterface` to `GuzzleHttp\Cookie\CookieJar`
+
+## 4.1.0 - 2014-05-27
+
+* Added a `json` request option to easily serialize JSON payloads.
+* Added a `GuzzleHttp\json_decode()` wrapper to safely parse JSON.
+* Added `setPort()` and `getPort()` to `GuzzleHttp\Message\RequestInterface`.
+* Added the ability to provide an emitter to a client in the client constructor.
+* Added the ability to persist a cookie session using $_SESSION.
+* Added a trait that can be used to add event listeners to an iterator.
+* Removed request method constants from RequestInterface.
+* Fixed warning when invalid request start-lines are received.
+* Updated MessageFactory to work with custom request option methods.
+* Updated cacert bundle to latest build.
+
+4.0.2 (2014-04-16)
+------------------
+
+* Proxy requests using the StreamAdapter now properly use request_fulluri (#632)
+* Added the ability to set scalars as POST fields (#628)
+
+## 4.0.1 - 2014-04-04
+
+* The HTTP status code of a response is now set as the exception code of
+ RequestException objects.
+* 303 redirects will now correctly switch from POST to GET requests.
+* The default parallel adapter of a client now correctly uses the MultiAdapter.
+* HasDataTrait now initializes the internal data array as an empty array so
+ that the toArray() method always returns an array.
+
+## 4.0.0 - 2014-03-29
+
+* For more information on the 4.0 transition, see:
+ http://mtdowling.com/blog/2014/03/15/guzzle-4-rc/
+* For information on changes and upgrading, see:
+ https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40
+* Added `GuzzleHttp\batch()` as a convenience function for sending requests in
+ parallel without needing to write asynchronous code.
+* Restructured how events are added to `GuzzleHttp\ClientInterface::sendAll()`.
+ You can now pass a callable or an array of associative arrays where each
+ associative array contains the "fn", "priority", and "once" keys.
+
+## 4.0.0.rc-2 - 2014-03-25
+
+* Removed `getConfig()` and `setConfig()` from clients to avoid confusion
+ around whether things like base_url, message_factory, etc. should be able to
+ be retrieved or modified.
+* Added `getDefaultOption()` and `setDefaultOption()` to ClientInterface
+* functions.php functions were renamed using snake_case to match PHP idioms
+* Added support for `HTTP_PROXY`, `HTTPS_PROXY`, and
+ `GUZZLE_CURL_SELECT_TIMEOUT` environment variables
+* Added the ability to specify custom `sendAll()` event priorities
+* Added the ability to specify custom stream context options to the stream
+ adapter.
+* Added a functions.php function for `get_path()` and `set_path()`
+* CurlAdapter and MultiAdapter now use a callable to generate curl resources
+* MockAdapter now properly reads a body and emits a `headers` event
+* Updated Url class to check if a scheme and host are set before adding ":"
+ and "//". This allows empty Url (e.g., "") to be serialized as "".
+* Parsing invalid XML no longer emits warnings
+* Curl classes now properly throw AdapterExceptions
+* Various performance optimizations
+* Streams are created with the faster `Stream\create()` function
+* Marked deprecation_proxy() as internal
+* Test server is now a collection of static methods on a class
+
+## 4.0.0-rc.1 - 2014-03-15
+
+* See https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40
+
+## 3.8.1 - 2014-01-28
+
+* Bug: Always using GET requests when redirecting from a 303 response
+* Bug: CURLOPT_SSL_VERIFYHOST is now correctly set to false when setting `$certificateAuthority` to false in
+ `Guzzle\Http\ClientInterface::setSslVerification()`
+* Bug: RedirectPlugin now uses strict RFC 3986 compliance when combining a base URL with a relative URL
+* Bug: The body of a request can now be set to `"0"`
+* Sending PHP stream requests no longer forces `HTTP/1.0`
+* Adding more information to ExceptionCollection exceptions so that users have more context, including a stack trace of
+ each sub-exception
+* Updated the `$ref` attribute in service descriptions to merge over any existing parameters of a schema (rather than
+ clobbering everything).
+* Merging URLs will now use the query string object from the relative URL (thus allowing custom query aggregators)
+* Query strings are now parsed in a way that they do no convert empty keys with no value to have a dangling `=`.
+ For example `foo&bar=baz` is now correctly parsed and recognized as `foo&bar=baz` rather than `foo=&bar=baz`.
+* Now properly escaping the regular expression delimiter when matching Cookie domains.
+* Network access is now disabled when loading XML documents
+
+## 3.8.0 - 2013-12-05
+
+* Added the ability to define a POST name for a file
+* JSON response parsing now properly walks additionalProperties
+* cURL error code 18 is now retried automatically in the BackoffPlugin
+* Fixed a cURL error when URLs contain fragments
+* Fixed an issue in the BackoffPlugin retry event where it was trying to access all exceptions as if they were
+ CurlExceptions
+* CURLOPT_PROGRESS function fix for PHP 5.5 (69fcc1e)
+* Added the ability for Guzzle to work with older versions of cURL that do not support `CURLOPT_TIMEOUT_MS`
+* Fixed a bug that was encountered when parsing empty header parameters
+* UriTemplate now has a `setRegex()` method to match the docs
+* The `debug` request parameter now checks if it is truthy rather than if it exists
+* Setting the `debug` request parameter to true shows verbose cURL output instead of using the LogPlugin
+* Added the ability to combine URLs using strict RFC 3986 compliance
+* Command objects can now return the validation errors encountered by the command
+* Various fixes to cache revalidation (#437 and 29797e5)
+* Various fixes to the AsyncPlugin
+* Cleaned up build scripts
+
+## 3.7.4 - 2013-10-02
+
+* Bug fix: 0 is now an allowed value in a description parameter that has a default value (#430)
+* Bug fix: SchemaFormatter now returns an integer when formatting to a Unix timestamp
+ (see https://github.com/aws/aws-sdk-php/issues/147)
+* Bug fix: Cleaned up and fixed URL dot segment removal to properly resolve internal dots
+* Minimum PHP version is now properly specified as 5.3.3 (up from 5.3.2) (#420)
+* Updated the bundled cacert.pem (#419)
+* OauthPlugin now supports adding authentication to headers or query string (#425)
+
+## 3.7.3 - 2013-09-08
+
+* Added the ability to get the exception associated with a request/command when using `MultiTransferException` and
+ `CommandTransferException`.
+* Setting `additionalParameters` of a response to false is now honored when parsing responses with a service description
+* Schemas are only injected into response models when explicitly configured.
+* No longer guessing Content-Type based on the path of a request. Content-Type is now only guessed based on the path of
+ an EntityBody.
+* Bug fix: ChunkedIterator can now properly chunk a \Traversable as well as an \Iterator.
+* Bug fix: FilterIterator now relies on `\Iterator` instead of `\Traversable`.
+* Bug fix: Gracefully handling malformed responses in RequestMediator::writeResponseBody()
+* Bug fix: Replaced call to canCache with canCacheRequest in the CallbackCanCacheStrategy of the CachePlugin
+* Bug fix: Visiting XML attributes first before visiting XML children when serializing requests
+* Bug fix: Properly parsing headers that contain commas contained in quotes
+* Bug fix: mimetype guessing based on a filename is now case-insensitive
+
+## 3.7.2 - 2013-08-02
+
+* Bug fix: Properly URL encoding paths when using the PHP-only version of the UriTemplate expander
+ See https://github.com/guzzle/guzzle/issues/371
+* Bug fix: Cookie domains are now matched correctly according to RFC 6265
+ See https://github.com/guzzle/guzzle/issues/377
+* Bug fix: GET parameters are now used when calculating an OAuth signature
+* Bug fix: Fixed an issue with cache revalidation where the If-None-Match header was being double quoted
+* `Guzzle\Common\AbstractHasDispatcher::dispatch()` now returns the event that was dispatched
+* `Guzzle\Http\QueryString::factory()` now guesses the most appropriate query aggregator to used based on the input.
+ See https://github.com/guzzle/guzzle/issues/379
+* Added a way to add custom domain objects to service description parsing using the `operation.parse_class` event. See
+ https://github.com/guzzle/guzzle/pull/380
+* cURL multi cleanup and optimizations
+
+## 3.7.1 - 2013-07-05
+
+* Bug fix: Setting default options on a client now works
+* Bug fix: Setting options on HEAD requests now works. See #352
+* Bug fix: Moving stream factory before send event to before building the stream. See #353
+* Bug fix: Cookies no longer match on IP addresses per RFC 6265
+* Bug fix: Correctly parsing header parameters that are in `<>` and quotes
+* Added `cert` and `ssl_key` as request options
+* `Host` header can now diverge from the host part of a URL if the header is set manually
+* `Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor` was rewritten to change from using SimpleXML to XMLWriter
+* OAuth parameters are only added via the plugin if they aren't already set
+* Exceptions are now thrown when a URL cannot be parsed
+* Returning `false` if `Guzzle\Http\EntityBody::getContentMd5()` fails
+* Not setting a `Content-MD5` on a command if calculating the Content-MD5 fails via the CommandContentMd5Plugin
+
+## 3.7.0 - 2013-06-10
+
+* See UPGRADING.md for more information on how to upgrade.
+* Requests now support the ability to specify an array of $options when creating a request to more easily modify a
+ request. You can pass a 'request.options' configuration setting to a client to apply default request options to
+ every request created by a client (e.g. default query string variables, headers, curl options, etc.).
+* Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`.
+ See `Guzzle\Http\StaticClient::mount`.
+* Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests
+ created by a command (e.g. custom headers, query string variables, timeout settings, etc.).
+* Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the
+ headers of a response
+* Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key
+ (e.g. `$collection->setPath('foo/baz/bar', 'test'); echo $collection['foo']['bar']['bar'];`)
+* ServiceBuilders now support storing and retrieving arbitrary data
+* CachePlugin can now purge all resources for a given URI
+* CachePlugin can automatically purge matching cached items when a non-idempotent request is sent to a resource
+* CachePlugin now uses the Vary header to determine if a resource is a cache hit
+* `Guzzle\Http\Message\Response` now implements `\Serializable`
+* Added `Guzzle\Cache\CacheAdapterFactory::fromCache()` to more easily create cache adapters
+* `Guzzle\Service\ClientInterface::execute()` now accepts an array, single command, or Traversable
+* Fixed a bug in `Guzzle\Http\Message\Header\Link::addLink()`
+* Better handling of calculating the size of a stream in `Guzzle\Stream\Stream` using fstat() and caching the size
+* `Guzzle\Common\Exception\ExceptionCollection` now creates a more readable exception message
+* Fixing BC break: Added back the MonologLogAdapter implementation rather than extending from PsrLog so that older
+ Symfony users can still use the old version of Monolog.
+* Fixing BC break: Added the implementation back in for `Guzzle\Http\Message\AbstractMessage::getTokenizedHeader()`.
+ Now triggering an E_USER_DEPRECATED warning when used. Use `$message->getHeader()->parseParams()`.
+* Several performance improvements to `Guzzle\Common\Collection`
+* Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`:
+ createRequest, head, delete, put, patch, post, options, prepareRequest
+* Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()`
+* Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface`
+* Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to
+ `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a
+ resource, string, or EntityBody into the $options parameter to specify the download location of the response.
+* Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a
+ default `array()`
+* Added `Guzzle\Stream\StreamInterface::isRepeatable`
+* Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use
+ $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or
+ $client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))`.
+* Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use $client->getConfig()->getPath('request.options/headers')`.
+* Removed `Guzzle\Http\ClientInterface::expandTemplate()`
+* Removed `Guzzle\Http\ClientInterface::setRequestFactory()`
+* Removed `Guzzle\Http\ClientInterface::getCurlMulti()`
+* Removed `Guzzle\Http\Message\RequestInterface::canCache`
+* Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`
+* Removed `Guzzle\Http\Message\RequestInterface::isRedirect`
+* Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods.
+* You can now enable E_USER_DEPRECATED warnings to see if you are using a deprecated method by setting
+ `Guzzle\Common\Version::$emitWarnings` to true.
+* Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use
+ `$request->getResponseBody()->isRepeatable()` instead.
+* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use
+ `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
+* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use
+ `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead.
+* Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead.
+* Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead.
+* Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated
+* Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand.
+ These will work through Guzzle 4.0
+* Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use [request.options][params].
+* Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client.
+* Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use $client->getConfig()->getPath('request.options/headers')`.
+* Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`.
+* Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8.
+* Marked `Guzzle\Common\Collection::inject()` as deprecated.
+* Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');`
+* CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a
+ CacheStorageInterface. These two objects and interface will be removed in a future version.
+* Always setting X-cache headers on cached responses
+* Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin
+* `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface
+ $request, Response $response);`
+* `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);`
+* `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);`
+* Added `CacheStorageInterface::purge($url)`
+* `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin
+ $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache,
+ CanCacheStrategyInterface $canCache = null)`
+* Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)`
+
+## 3.6.0 - 2013-05-29
+
+* ServiceDescription now implements ToArrayInterface
+* Added command.hidden_params to blacklist certain headers from being treated as additionalParameters
+* Guzzle can now correctly parse incomplete URLs
+* Mixed casing of headers are now forced to be a single consistent casing across all values for that header.
+* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution
+* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader().
+* Specific header implementations can be created for complex headers. When a message creates a header, it uses a
+ HeaderFactory which can map specific headers to specific header classes. There is now a Link header and
+ CacheControl header implementation.
+* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate
+* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti()
+* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in
+ Guzzle\Http\Curl\RequestMediator
+* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string.
+* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface
+* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders()
+* Removed Guzzle\Parser\ParserRegister::get(). Use getParser()
+* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser().
+* All response header helper functions return a string rather than mixing Header objects and strings inconsistently
+* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle
+ directly via interfaces
+* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
+ but are a no-op until removed.
+* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a
+ `Guzzle\Service\Command\ArrayCommandInterface`.
+* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response
+ on a request while the request is still being transferred
+* The ability to case-insensitively search for header values
+* Guzzle\Http\Message\Header::hasExactHeader
+* Guzzle\Http\Message\Header::raw. Use getAll()
+* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object
+ instead.
+* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess
+* Added the ability to cast Model objects to a string to view debug information.
+
+## 3.5.0 - 2013-05-13
+
+* Bug: Fixed a regression so that request responses are parsed only once per oncomplete event rather than multiple times
+* Bug: Better cleanup of one-time events across the board (when an event is meant to fire once, it will now remove
+ itself from the EventDispatcher)
+* Bug: `Guzzle\Log\MessageFormatter` now properly writes "total_time" and "connect_time" values
+* Bug: Cloning an EntityEnclosingRequest now clones the EntityBody too
+* Bug: Fixed an undefined index error when parsing nested JSON responses with a sentAs parameter that reference a
+ non-existent key
+* Bug: All __call() method arguments are now required (helps with mocking frameworks)
+* Deprecating Response::getRequest() and now using a shallow clone of a request object to remove a circular reference
+ to help with refcount based garbage collection of resources created by sending a request
+* Deprecating ZF1 cache and log adapters. These will be removed in the next major version.
+* Deprecating `Response::getPreviousResponse()` (method signature still exists, but it's deprecated). Use the
+ HistoryPlugin for a history.
+* Added a `responseBody` alias for the `response_body` location
+* Refactored internals to no longer rely on Response::getRequest()
+* HistoryPlugin can now be cast to a string
+* HistoryPlugin now logs transactions rather than requests and responses to more accurately keep track of the requests
+ and responses that are sent over the wire
+* Added `getEffectiveUrl()` and `getRedirectCount()` to Response objects
+
+## 3.4.3 - 2013-04-30
+
+* Bug fix: Fixing bug introduced in 3.4.2 where redirect responses are duplicated on the final redirected response
+* Added a check to re-extract the temp cacert bundle from the phar before sending each request
+
+## 3.4.2 - 2013-04-29
+
+* Bug fix: Stream objects now work correctly with "a" and "a+" modes
+* Bug fix: Removing `Transfer-Encoding: chunked` header when a Content-Length is present
+* Bug fix: AsyncPlugin no longer forces HEAD requests
+* Bug fix: DateTime timezones are now properly handled when using the service description schema formatter
+* Bug fix: CachePlugin now properly handles stale-if-error directives when a request to the origin server fails
+* Setting a response on a request will write to the custom request body from the response body if one is specified
+* LogPlugin now writes to php://output when STDERR is undefined
+* Added the ability to set multiple POST files for the same key in a single call
+* application/x-www-form-urlencoded POSTs now use the utf-8 charset by default
+* Added the ability to queue CurlExceptions to the MockPlugin
+* Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send)
+* Configuration loading now allows remote files
+
+## 3.4.1 - 2013-04-16
+
+* Large refactoring to how CurlMulti handles work. There is now a proxy that sits in front of a pool of CurlMulti
+ handles. This greatly simplifies the implementation, fixes a couple bugs, and provides a small performance boost.
+* Exceptions are now properly grouped when sending requests in parallel
+* Redirects are now properly aggregated when a multi transaction fails
+* Redirects now set the response on the original object even in the event of a failure
+* Bug fix: Model names are now properly set even when using $refs
+* Added support for PHP 5.5's CurlFile to prevent warnings with the deprecated @ syntax
+* Added support for oauth_callback in OAuth signatures
+* Added support for oauth_verifier in OAuth signatures
+* Added support to attempt to retrieve a command first literally, then ucfirst, the with inflection
+
+## 3.4.0 - 2013-04-11
+
+* Bug fix: URLs are now resolved correctly based on http://tools.ietf.org/html/rfc3986#section-5.2. #289
+* Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289
+* Bug fix: Parsing a query string with a single PHP array value will now result in an array. #263
+* Bug fix: Better normalization of the User-Agent header to prevent duplicate headers. #264.
+* Bug fix: Added `number` type to service descriptions.
+* Bug fix: empty parameters are removed from an OAuth signature
+* Bug fix: Revalidating a cache entry prefers the Last-Modified over the Date header
+* Bug fix: Fixed "array to string" error when validating a union of types in a service description
+* Bug fix: Removed code that attempted to determine the size of a stream when data is written to the stream
+* Bug fix: Not including an `oauth_token` if the value is null in the OauthPlugin.
+* Bug fix: Now correctly aggregating successful requests and failed requests in CurlMulti when a redirect occurs.
+* The new default CURLOPT_TIMEOUT setting has been increased to 150 seconds so that Guzzle works on poor connections.
+* Added a feature to EntityEnclosingRequest::setBody() that will automatically set the Content-Type of the request if
+ the Content-Type can be determined based on the entity body or the path of the request.
+* Added the ability to overwrite configuration settings in a client when grabbing a throwaway client from a builder.
+* Added support for a PSR-3 LogAdapter.
+* Added a `command.after_prepare` event
+* Added `oauth_callback` parameter to the OauthPlugin
+* Added the ability to create a custom stream class when using a stream factory
+* Added a CachingEntityBody decorator
+* Added support for `additionalParameters` in service descriptions to define how custom parameters are serialized.
+* The bundled SSL certificate is now provided in the phar file and extracted when running Guzzle from a phar.
+* You can now send any EntityEnclosingRequest with POST fields or POST files and cURL will handle creating bodies
+* POST requests using a custom entity body are now treated exactly like PUT requests but with a custom cURL method. This
+ means that the redirect behavior of POST requests with custom bodies will not be the same as POST requests that use
+ POST fields or files (the latter is only used when emulating a form POST in the browser).
+* Lots of cleanup to CurlHandle::factory and RequestFactory::createRequest
+
+## 3.3.1 - 2013-03-10
+
+* Added the ability to create PHP streaming responses from HTTP requests
+* Bug fix: Running any filters when parsing response headers with service descriptions
+* Bug fix: OauthPlugin fixes to allow for multi-dimensional array signing, and sorting parameters before signing
+* Bug fix: Removed the adding of default empty arrays and false Booleans to responses in order to be consistent across
+ response location visitors.
+* Bug fix: Removed the possibility of creating configuration files with circular dependencies
+* RequestFactory::create() now uses the key of a POST file when setting the POST file name
+* Added xmlAllowEmpty to serialize an XML body even if no XML specific parameters are set
+
+## 3.3.0 - 2013-03-03
+
+* A large number of performance optimizations have been made
+* Bug fix: Added 'wb' as a valid write mode for streams
+* Bug fix: `Guzzle\Http\Message\Response::json()` now allows scalar values to be returned
+* Bug fix: Fixed bug in `Guzzle\Http\Message\Response` where wrapping quotes were stripped from `getEtag()`
+* BC: Removed `Guzzle\Http\Utils` class
+* BC: Setting a service description on a client will no longer modify the client's command factories.
+* BC: Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using
+ the 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io'
+* BC: `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getSteamType()` are no longer converted to
+ lowercase
+* Operation parameter objects are now lazy loaded internally
+* Added ErrorResponsePlugin that can throw errors for responses defined in service description operations' errorResponses
+* Added support for instantiating responseType=class responseClass classes. Classes must implement
+ `Guzzle\Service\Command\ResponseClassInterface`
+* Added support for additionalProperties for top-level parameters in responseType=model responseClasses. These
+ additional properties also support locations and can be used to parse JSON responses where the outermost part of the
+ JSON is an array
+* Added support for nested renaming of JSON models (rename sentAs to name)
+* CachePlugin
+ * Added support for stale-if-error so that the CachePlugin can now serve stale content from the cache on error
+ * Debug headers can now added to cached response in the CachePlugin
+
+## 3.2.0 - 2013-02-14
+
+* CurlMulti is no longer reused globally. A new multi object is created per-client. This helps to isolate clients.
+* URLs with no path no longer contain a "/" by default
+* Guzzle\Http\QueryString does no longer manages the leading "?". This is now handled in Guzzle\Http\Url.
+* BadResponseException no longer includes the full request and response message
+* Adding setData() to Guzzle\Service\Description\ServiceDescriptionInterface
+* Adding getResponseBody() to Guzzle\Http\Message\RequestInterface
+* Various updates to classes to use ServiceDescriptionInterface type hints rather than ServiceDescription
+* Header values can now be normalized into distinct values when multiple headers are combined with a comma separated list
+* xmlEncoding can now be customized for the XML declaration of a XML service description operation
+* Guzzle\Http\QueryString now uses Guzzle\Http\QueryAggregator\QueryAggregatorInterface objects to add custom value
+ aggregation and no longer uses callbacks
+* The URL encoding implementation of Guzzle\Http\QueryString can now be customized
+* Bug fix: Filters were not always invoked for array service description parameters
+* Bug fix: Redirects now use a target response body rather than a temporary response body
+* Bug fix: The default exponential backoff BackoffPlugin was not giving when the request threshold was exceeded
+* Bug fix: Guzzle now takes the first found value when grabbing Cache-Control directives
+
+## 3.1.2 - 2013-01-27
+
+* Refactored how operation responses are parsed. Visitors now include a before() method responsible for parsing the
+ response body. For example, the XmlVisitor now parses the XML response into an array in the before() method.
+* Fixed an issue where cURL would not automatically decompress responses when the Accept-Encoding header was sent
+* CURLOPT_SSL_VERIFYHOST is never set to 1 because it is deprecated (see 5e0ff2ef20f839e19d1eeb298f90ba3598784444)
+* Fixed a bug where redirect responses were not chained correctly using getPreviousResponse()
+* Setting default headers on a client after setting the user-agent will not erase the user-agent setting
+
+## 3.1.1 - 2013-01-20
+
+* Adding wildcard support to Guzzle\Common\Collection::getPath()
+* Adding alias support to ServiceBuilder configs
+* Adding Guzzle\Service\Resource\CompositeResourceIteratorFactory and cleaning up factory interface
+
+## 3.1.0 - 2013-01-12
+
+* BC: CurlException now extends from RequestException rather than BadResponseException
+* BC: Renamed Guzzle\Plugin\Cache\CanCacheStrategyInterface::canCache() to canCacheRequest() and added CanCacheResponse()
+* Added getData to ServiceDescriptionInterface
+* Added context array to RequestInterface::setState()
+* Bug: Removing hard dependency on the BackoffPlugin from Guzzle\Http
+* Bug: Adding required content-type when JSON request visitor adds JSON to a command
+* Bug: Fixing the serialization of a service description with custom data
+* Made it easier to deal with exceptions thrown when transferring commands or requests in parallel by providing
+ an array of successful and failed responses
+* Moved getPath from Guzzle\Service\Resource\Model to Guzzle\Common\Collection
+* Added Guzzle\Http\IoEmittingEntityBody
+* Moved command filtration from validators to location visitors
+* Added `extends` attributes to service description parameters
+* Added getModels to ServiceDescriptionInterface
+
+## 3.0.7 - 2012-12-19
+
+* Fixing phar detection when forcing a cacert to system if null or true
+* Allowing filename to be passed to `Guzzle\Http\Message\Request::setResponseBody()`
+* Cleaning up `Guzzle\Common\Collection::inject` method
+* Adding a response_body location to service descriptions
+
+## 3.0.6 - 2012-12-09
+
+* CurlMulti performance improvements
+* Adding setErrorResponses() to Operation
+* composer.json tweaks
+
+## 3.0.5 - 2012-11-18
+
+* Bug: Fixing an infinite recursion bug caused from revalidating with the CachePlugin
+* Bug: Response body can now be a string containing "0"
+* Bug: Using Guzzle inside of a phar uses system by default but now allows for a custom cacert
+* Bug: QueryString::fromString now properly parses query string parameters that contain equal signs
+* Added support for XML attributes in service description responses
+* DefaultRequestSerializer now supports array URI parameter values for URI template expansion
+* Added better mimetype guessing to requests and post files
+
+## 3.0.4 - 2012-11-11
+
+* Bug: Fixed a bug when adding multiple cookies to a request to use the correct glue value
+* Bug: Cookies can now be added that have a name, domain, or value set to "0"
+* Bug: Using the system cacert bundle when using the Phar
+* Added json and xml methods to Response to make it easier to parse JSON and XML response data into data structures
+* Enhanced cookie jar de-duplication
+* Added the ability to enable strict cookie jars that throw exceptions when invalid cookies are added
+* Added setStream to StreamInterface to actually make it possible to implement custom rewind behavior for entity bodies
+* Added the ability to create any sort of hash for a stream rather than just an MD5 hash
+
+## 3.0.3 - 2012-11-04
+
+* Implementing redirects in PHP rather than cURL
+* Added PECL URI template extension and using as default parser if available
+* Bug: Fixed Content-Length parsing of Response factory
+* Adding rewind() method to entity bodies and streams. Allows for custom rewinding of non-repeatable streams.
+* Adding ToArrayInterface throughout library
+* Fixing OauthPlugin to create unique nonce values per request
+
+## 3.0.2 - 2012-10-25
+
+* Magic methods are enabled by default on clients
+* Magic methods return the result of a command
+* Service clients no longer require a base_url option in the factory
+* Bug: Fixed an issue with URI templates where null template variables were being expanded
+
+## 3.0.1 - 2012-10-22
+
+* Models can now be used like regular collection objects by calling filter, map, etc.
+* Models no longer require a Parameter structure or initial data in the constructor
+* Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator`
+
+## 3.0.0 - 2012-10-15
+
+* Rewrote service description format to be based on Swagger
+ * Now based on JSON schema
+ * Added nested input structures and nested response models
+ * Support for JSON and XML input and output models
+ * Renamed `commands` to `operations`
+ * Removed dot class notation
+ * Removed custom types
+* Broke the project into smaller top-level namespaces to be more component friendly
+* Removed support for XML configs and descriptions. Use arrays or JSON files.
+* Removed the Validation component and Inspector
+* Moved all cookie code to Guzzle\Plugin\Cookie
+* Magic methods on a Guzzle\Service\Client now return the command un-executed.
+* Calling getResult() or getResponse() on a command will lazily execute the command if needed.
+* Now shipping with cURL's CA certs and using it by default
+* Added previousResponse() method to response objects
+* No longer sending Accept and Accept-Encoding headers on every request
+* Only sending an Expect header by default when a payload is greater than 1MB
+* Added/moved client options:
+ * curl.blacklist to curl.option.blacklist
+ * Added ssl.certificate_authority
+* Added a Guzzle\Iterator component
+* Moved plugins from Guzzle\Http\Plugin to Guzzle\Plugin
+* Added a more robust backoff retry strategy (replaced the ExponentialBackoffPlugin)
+* Added a more robust caching plugin
+* Added setBody to response objects
+* Updating LogPlugin to use a more flexible MessageFormatter
+* Added a completely revamped build process
+* Cleaning up Collection class and removing default values from the get method
+* Fixed ZF2 cache adapters
+
+## 2.8.8 - 2012-10-15
+
+* Bug: Fixed a cookie issue that caused dot prefixed domains to not match where popular browsers did
+
+## 2.8.7 - 2012-09-30
+
+* Bug: Fixed config file aliases for JSON includes
+* Bug: Fixed cookie bug on a request object by using CookieParser to parse cookies on requests
+* Bug: Removing the path to a file when sending a Content-Disposition header on a POST upload
+* Bug: Hardening request and response parsing to account for missing parts
+* Bug: Fixed PEAR packaging
+* Bug: Fixed Request::getInfo
+* Bug: Fixed cases where CURLM_CALL_MULTI_PERFORM return codes were causing curl transactions to fail
+* Adding the ability for the namespace Iterator factory to look in multiple directories
+* Added more getters/setters/removers from service descriptions
+* Added the ability to remove POST fields from OAuth signatures
+* OAuth plugin now supports 2-legged OAuth
+
+## 2.8.6 - 2012-09-05
+
+* Added the ability to modify and build service descriptions
+* Added the use of visitors to apply parameters to locations in service descriptions using the dynamic command
+* Added a `json` parameter location
+* Now allowing dot notation for classes in the CacheAdapterFactory
+* Using the union of two arrays rather than an array_merge when extending service builder services and service params
+* Ensuring that a service is a string before doing strpos() checks on it when substituting services for references
+ in service builder config files.
+* Services defined in two different config files that include one another will by default replace the previously
+ defined service, but you can now create services that extend themselves and merge their settings over the previous
+* The JsonLoader now supports aliasing filenames with different filenames. This allows you to alias something like
+ '_default' with a default JSON configuration file.
+
+## 2.8.5 - 2012-08-29
+
+* Bug: Suppressed empty arrays from URI templates
+* Bug: Added the missing $options argument from ServiceDescription::factory to enable caching
+* Added support for HTTP responses that do not contain a reason phrase in the start-line
+* AbstractCommand commands are now invokable
+* Added a way to get the data used when signing an Oauth request before a request is sent
+
+## 2.8.4 - 2012-08-15
+
+* Bug: Custom delay time calculations are no longer ignored in the ExponentialBackoffPlugin
+* Added the ability to transfer entity bodies as a string rather than streamed. This gets around curl error 65. Set `body_as_string` in a request's curl options to enable.
+* Added a StreamInterface, EntityBodyInterface, and added ftell() to Guzzle\Common\Stream
+* Added an AbstractEntityBodyDecorator and a ReadLimitEntityBody decorator to transfer only a subset of a decorated stream
+* Stream and EntityBody objects will now return the file position to the previous position after a read required operation (e.g. getContentMd5())
+* Added additional response status codes
+* Removed SSL information from the default User-Agent header
+* DELETE requests can now send an entity body
+* Added an EventDispatcher to the ExponentialBackoffPlugin and added an ExponentialBackoffLogger to log backoff retries
+* Added the ability of the MockPlugin to consume mocked request bodies
+* LogPlugin now exposes request and response objects in the extras array
+
+## 2.8.3 - 2012-07-30
+
+* Bug: Fixed a case where empty POST requests were sent as GET requests
+* Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body
+* Bug: Setting the response body of a request to null after completing a request, not when setting the state of a request to new
+* Added multiple inheritance to service description commands
+* Added an ApiCommandInterface and added `getParamNames()` and `hasParam()`
+* Removed the default 2mb size cutoff from the Md5ValidatorPlugin so that it now defaults to validating everything
+* Changed CurlMulti::perform to pass a smaller timeout to CurlMulti::executeHandles
+
+## 2.8.2 - 2012-07-24
+
+* Bug: Query string values set to 0 are no longer dropped from the query string
+* Bug: A Collection object is no longer created each time a call is made to `Guzzle\Service\Command\AbstractCommand::getRequestHeaders()`
+* Bug: `+` is now treated as an encoded space when parsing query strings
+* QueryString and Collection performance improvements
+* Allowing dot notation for class paths in filters attribute of a service descriptions
+
+## 2.8.1 - 2012-07-16
+
+* Loosening Event Dispatcher dependency
+* POST redirects can now be customized using CURLOPT_POSTREDIR
+
+## 2.8.0 - 2012-07-15
+
+* BC: Guzzle\Http\Query
+ * Query strings with empty variables will always show an equal sign unless the variable is set to QueryString::BLANK (e.g. ?acl= vs ?acl)
+ * Changed isEncodingValues() and isEncodingFields() to isUrlEncoding()
+ * Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool)
+ * Changed the aggregation functions of QueryString to be static methods
+ * Can now use fromString() with querystrings that have a leading ?
+* cURL configuration values can be specified in service descriptions using `curl.` prefixed parameters
+* Content-Length is set to 0 before emitting the request.before_send event when sending an empty request body
+* Cookies are no longer URL decoded by default
+* Bug: URI template variables set to null are no longer expanded
+
+## 2.7.2 - 2012-07-02
+
+* BC: Moving things to get ready for subtree splits. Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser.
+* BC: Removing Guzzle\Common\Batch\Batch::count() and replacing it with isEmpty()
+* CachePlugin now allows for a custom request parameter function to check if a request can be cached
+* Bug fix: CachePlugin now only caches GET and HEAD requests by default
+* Bug fix: Using header glue when transferring headers over the wire
+* Allowing deeply nested arrays for composite variables in URI templates
+* Batch divisors can now return iterators or arrays
+
+## 2.7.1 - 2012-06-26
+
+* Minor patch to update version number in UA string
+* Updating build process
+
+## 2.7.0 - 2012-06-25
+
+* BC: Inflection classes moved to Guzzle\Inflection. No longer static methods. Can now inject custom inflectors into classes.
+* BC: Removed magic setX methods from commands
+* BC: Magic methods mapped to service description commands are now inflected in the command factory rather than the client __call() method
+* Verbose cURL options are no longer enabled by default. Set curl.debug to true on a client to enable.
+* Bug: Now allowing colons in a response start-line (e.g. HTTP/1.1 503 Service Unavailable: Back-end server is at capacity)
+* Guzzle\Service\Resource\ResourceIteratorApplyBatched now internally uses the Guzzle\Common\Batch namespace
+* Added Guzzle\Service\Plugin namespace and a PluginCollectionPlugin
+* Added the ability to set POST fields and files in a service description
+* Guzzle\Http\EntityBody::factory() now accepts objects with a __toString() method
+* Adding a command.before_prepare event to clients
+* Added BatchClosureTransfer and BatchClosureDivisor
+* BatchTransferException now includes references to the batch divisor and transfer strategies
+* Fixed some tests so that they pass more reliably
+* Added Guzzle\Common\Log\ArrayLogAdapter
+
+## 2.6.6 - 2012-06-10
+
+* BC: Removing Guzzle\Http\Plugin\BatchQueuePlugin
+* BC: Removing Guzzle\Service\Command\CommandSet
+* Adding generic batching system (replaces the batch queue plugin and command set)
+* Updating ZF cache and log adapters and now using ZF's composer repository
+* Bug: Setting the name of each ApiParam when creating through an ApiCommand
+* Adding result_type, result_doc, deprecated, and doc_url to service descriptions
+* Bug: Changed the default cookie header casing back to 'Cookie'
+
+## 2.6.5 - 2012-06-03
+
+* BC: Renaming Guzzle\Http\Message\RequestInterface::getResourceUri() to getResource()
+* BC: Removing unused AUTH_BASIC and AUTH_DIGEST constants from
+* BC: Guzzle\Http\Cookie is now used to manage Set-Cookie data, not Cookie data
+* BC: Renaming methods in the CookieJarInterface
+* Moving almost all cookie logic out of the CookiePlugin and into the Cookie or CookieJar implementations
+* Making the default glue for HTTP headers ';' instead of ','
+* Adding a removeValue to Guzzle\Http\Message\Header
+* Adding getCookies() to request interface.
+* Making it easier to add event subscribers to HasDispatcherInterface classes. Can now directly call addSubscriber()
+
+## 2.6.4 - 2012-05-30
+
+* BC: Cleaning up how POST files are stored in EntityEnclosingRequest objects. Adding PostFile class.
+* BC: Moving ApiCommand specific functionality from the Inspector and on to the ApiCommand
+* Bug: Fixing magic method command calls on clients
+* Bug: Email constraint only validates strings
+* Bug: Aggregate POST fields when POST files are present in curl handle
+* Bug: Fixing default User-Agent header
+* Bug: Only appending or prepending parameters in commands if they are specified
+* Bug: Not requiring response reason phrases or status codes to match a predefined list of codes
+* Allowing the use of dot notation for class namespaces when using instance_of constraint
+* Added any_match validation constraint
+* Added an AsyncPlugin
+* Passing request object to the calculateWait method of the ExponentialBackoffPlugin
+* Allowing the result of a command object to be changed
+* Parsing location and type sub values when instantiating a service description rather than over and over at runtime
+
+## 2.6.3 - 2012-05-23
+
+* [BC] Guzzle\Common\FromConfigInterface no longer requires any config options.
+* [BC] Refactoring how POST files are stored on an EntityEnclosingRequest. They are now separate from POST fields.
+* You can now use an array of data when creating PUT request bodies in the request factory.
+* Removing the requirement that HTTPS requests needed a Cache-Control: public directive to be cacheable.
+* [Http] Adding support for Content-Type in multipart POST uploads per upload
+* [Http] Added support for uploading multiple files using the same name (foo[0], foo[1])
+* Adding more POST data operations for easier manipulation of POST data.
+* You can now set empty POST fields.
+* The body of a request is only shown on EntityEnclosingRequest objects that do not use POST files.
+* Split the Guzzle\Service\Inspector::validateConfig method into two methods. One to initialize when a command is created, and one to validate.
+* CS updates
+
+## 2.6.2 - 2012-05-19
+
+* [Http] Better handling of nested scope requests in CurlMulti. Requests are now always prepares in the send() method rather than the addRequest() method.
+
+## 2.6.1 - 2012-05-19
+
+* [BC] Removing 'path' support in service descriptions. Use 'uri'.
+* [BC] Guzzle\Service\Inspector::parseDocBlock is now protected. Adding getApiParamsForClass() with cache.
+* [BC] Removing Guzzle\Common\NullObject. Use https://github.com/mtdowling/NullObject if you need it.
+* [BC] Removing Guzzle\Common\XmlElement.
+* All commands, both dynamic and concrete, have ApiCommand objects.
+* Adding a fix for CurlMulti so that if all of the connections encounter some sort of curl error, then the loop exits.
+* Adding checks to EntityEnclosingRequest so that empty POST files and fields are ignored.
+* Making the method signature of Guzzle\Service\Builder\ServiceBuilder::factory more flexible.
+
+## 2.6.0 - 2012-05-15
+
+* [BC] Moving Guzzle\Service\Builder to Guzzle\Service\Builder\ServiceBuilder
+* [BC] Executing a Command returns the result of the command rather than the command
+* [BC] Moving all HTTP parsing logic to Guzzle\Http\Parsers. Allows for faster C implementations if needed.
+* [BC] Changing the Guzzle\Http\Message\Response::setProtocol() method to accept a protocol and version in separate args.
+* [BC] Moving ResourceIterator* to Guzzle\Service\Resource
+* [BC] Completely refactored ResourceIterators to iterate over a cloned command object
+* [BC] Moved Guzzle\Http\UriTemplate to Guzzle\Http\Parser\UriTemplate\UriTemplate
+* [BC] Guzzle\Guzzle is now deprecated
+* Moving Guzzle\Common\Guzzle::inject to Guzzle\Common\Collection::inject
+* Adding Guzzle\Version class to give version information about Guzzle
+* Adding Guzzle\Http\Utils class to provide getDefaultUserAgent() and getHttpDate()
+* Adding Guzzle\Curl\CurlVersion to manage caching curl_version() data
+* ServiceDescription and ServiceBuilder are now cacheable using similar configs
+* Changing the format of XML and JSON service builder configs. Backwards compatible.
+* Cleaned up Cookie parsing
+* Trimming the default Guzzle User-Agent header
+* Adding a setOnComplete() method to Commands that is called when a command completes
+* Keeping track of requests that were mocked in the MockPlugin
+* Fixed a caching bug in the CacheAdapterFactory
+* Inspector objects can be injected into a Command object
+* Refactoring a lot of code and tests to be case insensitive when dealing with headers
+* Adding Guzzle\Http\Message\HeaderComparison for easy comparison of HTTP headers using a DSL
+* Adding the ability to set global option overrides to service builder configs
+* Adding the ability to include other service builder config files from within XML and JSON files
+* Moving the parseQuery method out of Url and on to QueryString::fromString() as a static factory method.
+
+## 2.5.0 - 2012-05-08
+
+* Major performance improvements
+* [BC] Simplifying Guzzle\Common\Collection. Please check to see if you are using features that are now deprecated.
+* [BC] Using a custom validation system that allows a flyweight implementation for much faster validation. No longer using Symfony2 Validation component.
+* [BC] No longer supporting "{{ }}" for injecting into command or UriTemplates. Use "{}"
+* Added the ability to passed parameters to all requests created by a client
+* Added callback functionality to the ExponentialBackoffPlugin
+* Using microtime in ExponentialBackoffPlugin to allow more granular backoff strategies.
+* Rewinding request stream bodies when retrying requests
+* Exception is thrown when JSON response body cannot be decoded
+* Added configurable magic method calls to clients and commands. This is off by default.
+* Fixed a defect that added a hash to every parsed URL part
+* Fixed duplicate none generation for OauthPlugin.
+* Emitting an event each time a client is generated by a ServiceBuilder
+* Using an ApiParams object instead of a Collection for parameters of an ApiCommand
+* cache.* request parameters should be renamed to params.cache.*
+* Added the ability to set arbitrary curl options on requests (disable_wire, progress, etc.). See CurlHandle.
+* Added the ability to disable type validation of service descriptions
+* ServiceDescriptions and ServiceBuilders are now Serializable
diff --git a/vendor/guzzlehttp/guzzle/LICENSE b/vendor/guzzlehttp/guzzle/LICENSE
new file mode 100644
index 0000000..ea7f07c
--- /dev/null
+++ b/vendor/guzzlehttp/guzzle/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2011-2016 Michael Dowling, https://github.com/mtdowling
+ * $data = [
+ * 'id' => '',
+ * 'title' => '',
+ * 'input_message_content' => ,
+ * 'reply_markup' => ,
+ * 'url' => '',
+ * 'hide_url' => true,
+ * 'description' => '',
+ * 'thumb_url' => '',
+ * 'thumb_width' => 30,
+ * 'thumb_height' => 30,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be article
+ * @method string getId() Unique identifier for this result, 1-64 Bytes
+ * @method string getTitle() Title of the result
+ * @method InputMessageContent getInputMessageContent() Content of the message to be sent
+ * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message
+ * @method string getUrl() Optional. URL of the result
+ * @method bool getHideUrl() Optional. Pass True, if you don't want the URL to be shown in the message
+ * @method string getDescription() Optional. Short description of the result
+ * @method string getThumbUrl() Optional. Url of the thumbnail for the result
+ * @method int getThumbWidth() Optional. Thumbnail width
+ * @method int getThumbHeight() Optional. Thumbnail height
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 Bytes
+ * @method $this setTitle(string $title) Title of the result
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Content of the message to be sent
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. Inline keyboard attached to the message
+ * @method $this setUrl(string $url) Optional. URL of the result
+ * @method $this setHideUrl(bool $hide_url) Optional. Pass True, if you don't want the URL to be shown in the message
+ * @method $this setDescription(string $description) Optional. Short description of the result
+ * @method $this setThumbUrl(string $thumb_url) Optional. Url of the thumbnail for the result
+ * @method $this setThumbWidth(int $thumb_width) Optional. Thumbnail width
+ * @method $this setThumbHeight(int $thumb_height) Optional. Thumbnail height
+ */
+class InlineQueryResultArticle extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultArticle constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'article';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultAudio.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultAudio.php
new file mode 100644
index 0000000..940bd17
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultAudio.php
@@ -0,0 +1,67 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultAudio
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultaudio
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'audio_url' => '',
+ * 'title' => '',
+ * 'caption' => '',
+ * 'performer' => '',
+ * 'audio_duration' => 123,
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be audio
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getAudioUrl() A valid URL for the audio file
+ * @method string getTitle() Title
+ * @method string getCaption() Optional. Caption, 0-200 characters
+ * @method string getPerformer() Optional. Performer
+ * @method int getAudioDuration() Optional. Audio duration in seconds
+ * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the audio
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setAudioUrl(string $audio_url) A valid URL for the audio file
+ * @method $this setTitle(string $title) Title
+ * @method $this setCaption(string $caption) Optional. Caption, 0-200 characters
+ * @method $this setPerformer(string $performer) Optional. Performer
+ * @method $this setAudioDuration(int $audio_duration) Optional. Audio duration in seconds
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the audio
+ */
+class InlineQueryResultAudio extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultAudio constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'audio';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedAudio.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedAudio.php
new file mode 100644
index 0000000..780cef6
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedAudio.php
@@ -0,0 +1,58 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultCachedAudio
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultcachedaudio
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'audio_file_id' => '',
+ * 'caption' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be audio
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getAudioFileId() A valid file identifier for the audio file
+ * @method string getCaption() Optional. Caption, 0-200 characters
+ * @method InlineKeyboard getReplyMarkup() Optional. An Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the audio
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setAudioFileId(string $audio_file_id) A valid file identifier for the audio file
+ * @method $this setCaption(string $caption) Optional. Caption, 0-200 characters
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. An Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the audio
+ */
+class InlineQueryResultCachedAudio extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultCachedAudio constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'audio';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedDocument.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedDocument.php
new file mode 100644
index 0000000..c229551
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedDocument.php
@@ -0,0 +1,64 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultCachedDocument
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultcacheddocument
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'title' => '',
+ * 'document_file_id' => '',
+ * 'description' => '',
+ * 'caption' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be document
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getTitle() Title for the result
+ * @method string getDocumentFileId() A valid file identifier for the file
+ * @method string getDescription() Optional. Short description of the result
+ * @method string getCaption() Optional. Caption of the document to be sent, 0-200 characters
+ * @method InlineKeyboard getReplyMarkup() Optional. An Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the file
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setTitle(string $title) Title for the result
+ * @method $this setDocumentFileId(string $document_file_id) A valid file identifier for the file
+ * @method $this setDescription(string $description) Optional. Short description of the result
+ * @method $this setCaption(string $caption) Optional. Caption of the document to be sent, 0-200 characters
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. An Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the file
+ */
+class InlineQueryResultCachedDocument extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultCachedDocument constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'document';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedGif.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedGif.php
new file mode 100644
index 0000000..491a498
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedGif.php
@@ -0,0 +1,61 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultCachedGif
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultcachedgif
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'gif_file_id' => '',
+ * 'title' => '',
+ * 'caption' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be gif
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getGifFileId() A valid file identifier for the GIF file
+ * @method string getTitle() Optional. Title for the result
+ * @method string getCaption() Optional. Caption of the GIF file to be sent, 0-200 characters
+ * @method InlineKeyboard getReplyMarkup() Optional. An Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the GIF animation
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setGifFileId(string $gif_file_id) A valid file identifier for the GIF file
+ * @method $this setTitle(string $title) Optional. Title for the result
+ * @method $this setCaption(string $caption) Optional. Caption of the GIF file to be sent, 0-200 characters
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. An Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the GIF animation
+ */
+class InlineQueryResultCachedGif extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultCachedGif constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'gif';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedMpeg4Gif.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedMpeg4Gif.php
new file mode 100644
index 0000000..c2a5fd9
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedMpeg4Gif.php
@@ -0,0 +1,61 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultCachedMpeg4Gif
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'mpeg4_file_id' => '',
+ * 'title' => '',
+ * 'caption' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be mpeg4_gif
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getMpeg4FileId() A valid file identifier for the MP4 file
+ * @method string getTitle() Optional. Title for the result
+ * @method string getCaption() Optional. Caption of the MPEG-4 file to be sent, 0-200 characters
+ * @method InlineKeyboard getReplyMarkup() Optional. An Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the video animation
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setMpeg4FileId(string $mpeg4_file_id) A valid file identifier for the MP4 file
+ * @method $this setTitle(string $title) Optional. Title for the result
+ * @method $this setCaption(string $caption) Optional. Caption of the MPEG-4 file to be sent, 0-200 characters
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. An Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the video animation
+ */
+class InlineQueryResultCachedMpeg4Gif extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultCachedMpeg4Gif constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'mpeg4_gif';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedPhoto.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedPhoto.php
new file mode 100644
index 0000000..97caf5f
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedPhoto.php
@@ -0,0 +1,64 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultCachedPhoto
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultcachedphoto
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'photo_file_id' => '',
+ * 'title' => '',
+ * 'description' => '',
+ * 'caption' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be photo
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getPhotoFileId() A valid file identifier of the photo
+ * @method string getTitle() Optional. Title for the result
+ * @method string getDescription() Optional. Short description of the result
+ * @method string getCaption() Optional. Caption of the photo to be sent, 0-200 characters
+ * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the photo
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setPhotoFileId(string $photo_file_id) A valid file identifier of the photo
+ * @method $this setTitle(string $title) Optional. Title for the result
+ * @method $this setDescription(string $description) Optional. Short description of the result
+ * @method $this setCaption(string $caption) Optional. Caption of the photo to be sent, 0-200 characters
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the photo
+ */
+class InlineQueryResultCachedPhoto extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultCachedPhoto constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'photo';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedSticker.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedSticker.php
new file mode 100644
index 0000000..3a6677a
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedSticker.php
@@ -0,0 +1,55 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultCachedSticker
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultcachedsticker
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'sticker_file_id' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be sticker
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getStickerFileId() A valid file identifier of the sticker
+ * @method InlineKeyboard getReplyMarkup() Optional. An Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the sticker
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setStickerFileId(string $sticker_file_id) A valid file identifier of the sticker
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. An Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the sticker
+ */
+class InlineQueryResultCachedSticker extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultCachedSticker constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'sticker';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedVideo.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedVideo.php
new file mode 100644
index 0000000..9cc61e2
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedVideo.php
@@ -0,0 +1,64 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultCachedVideo
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultcachedvideo
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'video_file_id' => '',
+ * 'title' => '',
+ * 'description' => '',
+ * 'caption' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be video
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getVideoFileId() A valid file identifier for the video file
+ * @method string getTitle() Title for the result
+ * @method string getDescription() Optional. Short description of the result
+ * @method string getCaption() Optional. Caption of the video to be sent, 0-200 characters
+ * @method InlineKeyboard getReplyMarkup() Optional. An Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the video
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setVideoFileId(string $video_file_id) A valid file identifier for the video file
+ * @method $this setTitle(string $title) Title for the result
+ * @method $this setDescription(string $description) Optional. Short description of the result
+ * @method $this setCaption(string $caption) Optional. Caption of the video to be sent, 0-200 characters
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. An Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the video
+ */
+class InlineQueryResultCachedVideo extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultCachedVideo constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'video';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedVoice.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedVoice.php
new file mode 100644
index 0000000..bd87ecf
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultCachedVoice.php
@@ -0,0 +1,61 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultCachedVoice
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultcachedvoice
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'voice_file_id' => '',
+ * 'title' => '',
+ * 'caption' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be voice
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getVoiceFileId() A valid file identifier for the voice message
+ * @method string getTitle() Voice message title
+ * @method string getCaption() Optional. Caption, 0-200 characters
+ * @method InlineKeyboard getReplyMarkup() Optional. An Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the voice message
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setVoiceFileId(string $voice_file_id) A valid file identifier for the voice message
+ * @method $this setTitle(string $title) Voice message title
+ * @method $this setCaption(string $caption) Optional. Caption, 0-200 characters
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. An Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the voice message
+ */
+class InlineQueryResultCachedVoice extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultCachedVoice constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'voice';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultContact.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultContact.php
new file mode 100644
index 0000000..7b64eda
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultContact.php
@@ -0,0 +1,70 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultContact
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultcontact
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'phone_number' => '',
+ * 'first_name' => '',
+ * 'last_name' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * 'thumb_url' => '',
+ * 'thumb_width' => 30,
+ * 'thumb_height' => 30,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be contact
+ * @method string getId() Unique identifier for this result, 1-64 Bytes
+ * @method string getPhoneNumber() Contact's phone number
+ * @method string getFirstName() Contact's first name
+ * @method string getLastName() Optional. Contact's last name
+ * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the contact
+ * @method string getThumbUrl() Optional. Url of the thumbnail for the result
+ * @method int getThumbWidth() Optional. Thumbnail width
+ * @method int getThumbHeight() Optional. Thumbnail height
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 Bytes
+ * @method $this setPhoneNumber(string $phone_number) Contact's phone number
+ * @method $this setFirstName(string $first_name) Contact's first name
+ * @method $this setLastName(string $last_name) Optional. Contact's last name
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the contact
+ * @method $this setThumbUrl(string $thumb_url) Optional. Url of the thumbnail for the result
+ * @method $this setThumbWidth(int $thumb_width) Optional. Thumbnail width
+ * @method $this setThumbHeight(int $thumb_height) Optional. Thumbnail height
+ */
+class InlineQueryResultContact extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultContact constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'contact';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultDocument.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultDocument.php
new file mode 100644
index 0000000..ae5b275
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultDocument.php
@@ -0,0 +1,76 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultDocument
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultdocument
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'title' => '',
+ * 'caption' => '',
+ * 'document_url' => '',
+ * 'mime_type' => '',
+ * 'description' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * 'thumb_url' => '',
+ * 'thumb_width' => 30,
+ * 'thumb_height' => 30,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be document
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getTitle() Title for the result
+ * @method string getCaption() Optional. Caption of the document to be sent, 0-200 characters
+ * @method string getDocumentUrl() A valid URL for the file
+ * @method string getMimeType() Mime type of the content of the file, either “application/pdf” or “application/zip”
+ * @method string getDescription() Optional. Short description of the result
+ * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the file
+ * @method string getThumbUrl() Optional. URL of the thumbnail (jpeg only) for the file
+ * @method int getThumbWidth() Optional. Thumbnail width
+ * @method int getThumbHeight() Optional. Thumbnail height
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setTitle(string $title) Title for the result
+ * @method $this setCaption(string $caption) Optional. Caption of the document to be sent, 0-200 characters
+ * @method $this setDocumentUrl(string $document_url) A valid URL for the file
+ * @method $this setMimeType(string $mime_type) Mime type of the content of the file, either “application/pdf” or “application/zip”
+ * @method $this setDescription(string $description) Optional. Short description of the result
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the file
+ * @method $this setThumbUrl(string $thumb_url) Optional. URL of the thumbnail (jpeg only) for the file
+ * @method $this setThumbWidth(int $thumb_width) Optional. Thumbnail width
+ * @method $this setThumbHeight(int $thumb_height) Optional. Thumbnail height
+ */
+class InlineQueryResultDocument extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultDocument constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'document';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultGif.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultGif.php
new file mode 100644
index 0000000..e552f63
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultGif.php
@@ -0,0 +1,72 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultGif
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultgif
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'gif_url' => '',
+ * 'gif_width' => 30,
+ * 'gif_height' => 30,
+ * 'thumb_url' => '',
+ * 'title' => '',
+ * 'caption' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be gif
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getGifUrl() A valid URL for the GIF file. File size must not exceed 1MB
+ * @method int getGifWidth() Optional. Width of the GIF
+ * @method int getGifHeight() Optional. Height of the GIF
+ * @method int getGifDuration() Optional. Duration of the GIF
+ * @method string getThumbUrl() URL of the static thumbnail for the result (jpeg or gif)
+ * @method string getTitle() Optional. Title for the result
+ * @method string getCaption() Optional. Caption of the GIF file to be sent, 0-200 characters
+ * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the GIF animation
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setGifUrl(string $gif_url) A valid URL for the GIF file. File size must not exceed 1MB
+ * @method $this setGifWidth(int $gif_width) Optional. Width of the GIF
+ * @method $this setGifHeight(int $gif_height) Optional. Height of the GIF
+ * @method $this setGifDuration(int $gif_duration) Optional. Duration of the GIF
+ * @method $this setThumbUrl(string $thumb_url) URL of the static thumbnail for the result (jpeg or gif)
+ * @method $this setTitle(string $title) Optional. Title for the result
+ * @method $this setCaption(string $caption) Optional. Caption of the GIF file to be sent, 0-200 characters
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the GIF animation
+ */
+class InlineQueryResultGif extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultGif constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'gif';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultLocation.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultLocation.php
new file mode 100644
index 0000000..f365ae4
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultLocation.php
@@ -0,0 +1,73 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultLocation
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultlocation
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'latitude' => 36.0338,
+ * 'longitude' => 71.8601,
+ * 'title' => '',
+ * 'live_period' => 900,
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * 'thumb_url' => '',
+ * 'thumb_width' => 30,
+ * 'thumb_height' => 30,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be location
+ * @method string getId() Unique identifier for this result, 1-64 Bytes
+ * @method float getLatitude() Location latitude in degrees
+ * @method float getLongitude() Location longitude in degrees
+ * @method string getTitle() Location title
+ * @method int getLivePeriod() Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
+ * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the location
+ * @method string getThumbUrl() Optional. Url of the thumbnail for the result
+ * @method int getThumbWidth() Optional. Thumbnail width
+ * @method int getThumbHeight() Optional. Thumbnail height
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 Bytes
+ * @method $this setLatitude(float $latitude) Location latitude in degrees
+ * @method $this setLongitude(float $longitude) Location longitude in degrees
+ * @method $this setTitle(string $title) Location title
+ * @method $this setLivePeriod(int $live_period) Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the location
+ * @method $this setThumbUrl(string $thumb_url) Optional. Url of the thumbnail for the result
+ * @method $this setThumbWidth(int $thumb_width) Optional. Thumbnail width
+ * @method $this setThumbHeight(int $thumb_height) Optional. Thumbnail height
+ */
+class InlineQueryResultLocation extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultLocation constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'location';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultMpeg4Gif.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultMpeg4Gif.php
new file mode 100644
index 0000000..d182cb1
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultMpeg4Gif.php
@@ -0,0 +1,72 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultMpeg4Gif
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'mpeg4_url' => '',
+ * 'mpeg4_width' => 30,
+ * 'mpeg4_height' => 30,
+ * 'thumb_url' => '',
+ * 'title' => '',
+ * 'caption' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be mpeg4_gif
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getMpeg4Url() A valid URL for the MP4 file. File size must not exceed 1MB
+ * @method int getMpeg4Width() Optional. Video width
+ * @method int getMpeg4Height() Optional. Video height
+ * @method int getMpeg4Duration() Optional. Video duration
+ * @method string getThumbUrl() URL of the static thumbnail (jpeg or gif) for the result
+ * @method string getTitle() Optional. Title for the result
+ * @method string getCaption() Optional. Caption of the MPEG-4 file to be sent, 0-200 characters
+ * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the video animation
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setMpeg4Url(string $mpeg4_url) A valid URL for the MP4 file. File size must not exceed 1MB
+ * @method $this setMpeg4Width(int $mpeg4_width) Optional. Video width
+ * @method $this setMpeg4Height(int $mpeg4_height) Optional. Video height
+ * @method $this setMpeg4Duration(int $mpeg4_duration) Optional. Video duration
+ * @method $this setThumbUrl(string $thumb_url) URL of the static thumbnail (jpeg or gif) for the result
+ * @method $this setTitle(string $title) Optional. Title for the result
+ * @method $this setCaption(string $caption) Optional. Caption of the MPEG-4 file to be sent, 0-200 characters
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the video animation
+ */
+class InlineQueryResultMpeg4Gif extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultMpeg4Gif constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'mpeg4_gif';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultPhoto.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultPhoto.php
new file mode 100644
index 0000000..1dca095
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultPhoto.php
@@ -0,0 +1,73 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultPhoto
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultphoto
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'photo_url' => '',
+ * 'thumb_url' => '',
+ * 'photo_width' => 30,
+ * 'photo_height' => 30,
+ * 'title' => '',
+ * 'description' => '',
+ * 'caption' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be photo
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getPhotoUrl() A valid URL of the photo. Photo must be in jpeg format. Photo size must not exceed 5MB
+ * @method string getThumbUrl() URL of the thumbnail for the photo
+ * @method int getPhotoWidth() Optional. Width of the photo
+ * @method int getPhotoHeight() Optional. Height of the photo
+ * @method string getTitle() Optional. Title for the result
+ * @method string getDescription() Optional. Short description of the result
+ * @method string getCaption() Optional. Caption of the photo to be sent, 0-200 characters
+ * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the photo
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setPhotoUrl(string $photo_url) A valid URL of the photo. Photo must be in jpeg format. Photo size must not exceed 5MB
+ * @method $this setThumbUrl(string $thumb_url) URL of the thumbnail for the photo
+ * @method $this setPhotoWidth(int $photo_width) Optional. Width of the photo
+ * @method $this setPhotoHeight(int $photo_height) Optional. Height of the photo
+ * @method $this setTitle(string $title) Optional. Title for the result
+ * @method $this setDescription(string $description) Optional. Short description of the result
+ * @method $this setCaption(string $caption) Optional. Caption of the photo to be sent, 0-200 characters
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the photo
+ */
+class InlineQueryResultPhoto extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultPhoto constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'photo';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultVenue.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultVenue.php
new file mode 100644
index 0000000..acc3266
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultVenue.php
@@ -0,0 +1,76 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultVenue
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultvenue
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'latitude' => 36.0338,
+ * 'longitude' => 71.8601,
+ * 'title' => '',
+ * 'address' => '',
+ * 'foursquare_id' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * 'thumb_url' => '',
+ * 'thumb_width' => 30,
+ * 'thumb_height' => 30,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be venue
+ * @method string getId() Unique identifier for this result, 1-64 Bytes
+ * @method float getLatitude() Latitude of the venue location in degrees
+ * @method float getLongitude() Longitude of the venue location in degrees
+ * @method string getTitle() Title of the venue
+ * @method string getAddress() Address of the venue
+ * @method string getFoursquareId() Optional. Foursquare identifier of the venue if known
+ * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the venue
+ * @method string getThumbUrl() Optional. Url of the thumbnail for the result
+ * @method int getThumbWidth() Optional. Thumbnail width
+ * @method int getThumbHeight() Optional. Thumbnail height
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 Bytes
+ * @method $this setLatitude(float $latitude) Latitude of the venue location in degrees
+ * @method $this setLongitude(float $longitude) Longitude of the venue location in degrees
+ * @method $this setTitle(string $title) Title of the venue
+ * @method $this setAddress(string $address) Address of the venue
+ * @method $this setFoursquareId(string $foursquare_id) Optional. Foursquare identifier of the venue if known
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the venue
+ * @method $this setThumbUrl(string $thumb_url) Optional. Url of the thumbnail for the result
+ * @method $this setThumbWidth(int $thumb_width) Optional. Thumbnail width
+ * @method $this setThumbHeight(int $thumb_height) Optional. Thumbnail height
+ */
+class InlineQueryResultVenue extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultVenue constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'venue';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultVideo.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultVideo.php
new file mode 100644
index 0000000..8cca4d6
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultVideo.php
@@ -0,0 +1,79 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultVideo
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultvideo
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'video_url' => '',
+ * 'mime_type' => '',
+ * 'thumb_url' => '',
+ * 'title' => '',
+ * 'caption' => '',
+ * 'video_width' => 30,
+ * 'video_height' => 30,
+ * 'video_duration' => 123,
+ * 'description' => '',
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be video
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getVideoUrl() A valid URL for the embedded video player or video file
+ * @method string getMimeType() Mime type of the content of video url, “text/html” or “video/mp4”
+ * @method string getThumbUrl() URL of the thumbnail (jpeg only) for the video
+ * @method string getTitle() Title for the result
+ * @method string getCaption() Optional. Caption of the video to be sent, 0-200 characters
+ * @method int getVideoWidth() Optional. Video width
+ * @method int getVideoHeight() Optional. Video height
+ * @method int getVideoDuration() Optional. Video duration in seconds
+ * @method string getDescription() Optional. Short description of the result
+ * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the video
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setVideoUrl(string $video_url) A valid URL for the embedded video player or video file
+ * @method $this setMimeType(string $mime_type) Mime type of the content of video url, “text/html” or “video/mp4”
+ * @method $this setThumbUrl(string $thumb_url) URL of the thumbnail (jpeg only) for the video
+ * @method $this setTitle(string $title) Title for the result
+ * @method $this setCaption(string $caption) Optional. Caption of the video to be sent, 0-200 characters
+ * @method $this setVideoWidth(int $video_width) Optional. Video width
+ * @method $this setVideoHeight(int $video_height) Optional. Video height
+ * @method $this setVideoDuration(int $video_duration) Optional. Video duration in seconds
+ * @method $this setDescription(string $description) Optional. Short description of the result
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the video
+ */
+class InlineQueryResultVideo extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultVideo constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'video';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultVoice.php b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultVoice.php
new file mode 100644
index 0000000..6dc8d13
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InlineQuery/InlineQueryResultVoice.php
@@ -0,0 +1,64 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InlineQuery;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InputMessageContent\InputMessageContent;
+
+/**
+ * Class InlineQueryResultVoice
+ *
+ * @link https://core.telegram.org/bots/api#inlinequeryresultvoice
+ *
+ *
+ * $data = [
+ * 'id' => '',
+ * 'voice_url' => '',
+ * 'title' => '',
+ * 'caption' => '',
+ * 'voice_duration' => 123,
+ * 'reply_markup' => ,
+ * 'input_message_content' => ,
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be voice
+ * @method string getId() Unique identifier for this result, 1-64 bytes
+ * @method string getVoiceUrl() A valid URL for the voice recording
+ * @method string getTitle() Recording title
+ * @method string getCaption() Optional. Caption, 0-200 characters
+ * @method int getVoiceDuration() Optional. Recording duration in seconds
+ * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message
+ * @method InputMessageContent getInputMessageContent() Optional. Content of the message to be sent instead of the voice recording
+ *
+ * @method $this setId(string $id) Unique identifier for this result, 1-64 bytes
+ * @method $this setVoiceUrl(string $voice_url) A valid URL for the voice recording
+ * @method $this setTitle(string $title) Recording title
+ * @method $this setCaption(string $caption) Optional. Caption, 0-200 characters
+ * @method $this setVoiceDuration(int $voice_duration) Optional. Recording duration in seconds
+ * @method $this setReplyMarkup(InlineKeyboard $reply_markup) Optional. Inline keyboard attached to the message
+ * @method $this setInputMessageContent(InputMessageContent $input_message_content) Optional. Content of the message to be sent instead of the voice recording
+ */
+class InlineQueryResultVoice extends InlineEntity implements InlineQueryResult
+{
+ /**
+ * InlineQueryResultVoice constructor
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data = [])
+ {
+ $data['type'] = 'voice';
+ parent::__construct($data);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InputMedia/InputMedia.php b/vendor/longman/telegram-bot/src/Entities/InputMedia/InputMedia.php
new file mode 100644
index 0000000..b9bd973
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InputMedia/InputMedia.php
@@ -0,0 +1,8 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InputMedia;
+
+use Longman\TelegramBot\Entities\Entity;
+
+/**
+ * Class InputMediaPhoto
+ *
+ * @link https://core.telegram.org/bots/api#inputmediaphoto
+ *
+ *
+ * $data = [
+ * 'media' => '123abc',
+ * 'caption' => 'Photo caption',
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be photo
+ * @method string getMedia() File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://
+ * $data = [
+ * 'media' => '123abc',
+ * 'caption' => 'Video caption',
+ * 'width' => 800,
+ * 'heidht' => 600,
+ * 'duration' => 42
+ * ];
+ *
+ *
+ * @method string getType() Type of the result, must be video
+ * @method string getMedia() File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://
+ * $data = [
+ * 'phone_number' => '',
+ * 'first_name' => '',
+ * 'last_name' => '',
+ * ];
+ *
+ *
+ * @method string getPhoneNumber() Contact's phone number
+ * @method string getFirstName() Contact's first name
+ * @method string getLastName() Optional. Contact's last name
+ *
+ * @method $this setPhoneNumber(string $phone_number) Contact's phone number
+ * @method $this setFirstName(string $first_name) Contact's first name
+ * @method $this setLastName(string $last_name) Optional. Contact's last name
+ */
+class InputContactMessageContent extends InlineEntity implements InputMessageContent
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InputMessageContent/InputLocationMessageContent.php b/vendor/longman/telegram-bot/src/Entities/InputMessageContent/InputLocationMessageContent.php
new file mode 100644
index 0000000..2508a27
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InputMessageContent/InputLocationMessageContent.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InputMessageContent;
+
+use Longman\TelegramBot\Entities\InlineQuery\InlineEntity;
+
+/**
+ * Class InputLocationMessageContent
+ *
+ * @link https://core.telegram.org/bots/api#inputlocationmessagecontent
+ *
+ *
+ * $data = [
+ * 'latitude' => 36.0338,
+ * 'longitude' => 71.8601,
+ * 'live_period' => 900,
+ * ];
+ *
+ * @method float getLatitude() Latitude of the location in degrees
+ * @method float getLongitude() Longitude of the location in degrees
+ * @method int getLivePeriod() Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
+ *
+ * @method $this setLatitude(float $latitude) Latitude of the location in degrees
+ * @method $this setLongitude(float $longitude) Longitude of the location in degrees
+ * @method $this setLivePeriod(int $live_period) Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
+ */
+class InputLocationMessageContent extends InlineEntity implements InputMessageContent
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InputMessageContent/InputMessageContent.php b/vendor/longman/telegram-bot/src/Entities/InputMessageContent/InputMessageContent.php
new file mode 100644
index 0000000..3b43be9
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InputMessageContent/InputMessageContent.php
@@ -0,0 +1,8 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InputMessageContent;
+
+use Longman\TelegramBot\Entities\InlineQuery\InlineEntity;
+
+/**
+ * Class InputTextMessageContent
+ *
+ * @link https://core.telegram.org/bots/api#inputtextmessagecontent
+ *
+ *
+ * $data = [
+ * 'message_text' => '',
+ * 'parse_mode' => '',
+ * 'disable_web_page_preview' => true,
+ * ];
+ *
+ *
+ * @method string getMessageText() Text of the message to be sent, 1-4096 characters.
+ * @method string getParseMode() Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
+ * @method bool getDisableWebPagePreview() Optional. Disables link previews for links in the sent message
+ *
+ * @method $this setMessageText(string $message_text) Text of the message to be sent, 1-4096 characters.
+ * @method $this setParseMode(string $parse_mode) Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
+ * @method $this setDisableWebPagePreview(bool $disable_web_page_preview) Optional. Disables link previews for links in the sent message
+ */
+class InputTextMessageContent extends InlineEntity implements InputMessageContent
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/InputMessageContent/InputVenueMessageContent.php b/vendor/longman/telegram-bot/src/Entities/InputMessageContent/InputVenueMessageContent.php
new file mode 100644
index 0000000..4d00cab
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/InputMessageContent/InputVenueMessageContent.php
@@ -0,0 +1,45 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\InputMessageContent;
+
+use Longman\TelegramBot\Entities\InlineQuery\InlineEntity;
+
+/**
+ * Class InputVenueMessageContent
+ *
+ * @link https://core.telegram.org/bots/api#inputvenuemessagecontent
+ *
+ *
+ * $data = [
+ * 'latitude' => 36.0338,
+ * 'longitude' => 71.8601,
+ * 'title' => '',
+ * 'address' => '',
+ * 'foursquare_id' => '',
+ * ];
+ *
+ *
+ * @method float getLatitude() Latitude of the location in degrees
+ * @method float getLongitude() Longitude of the location in degrees
+ * @method string getTitle() Name of the venue
+ * @method string getAddress() Address of the venue
+ * @method string getFoursquareIdTitle() Optional. Foursquare identifier of the venue, if known
+ *
+ * @method $this setLatitude(float $latitude) Latitude of the location in degrees
+ * @method $this setLongitude(float $longitude) Longitude of the location in degrees
+ * @method $this setTitle(string $title) Name of the venue
+ * @method $this setAddress(string $address) Address of the venue
+ * @method $this setFoursquareIdTitle(string $foursquare_id_title) Optional. Foursquare identifier of the venue, if known
+ */
+class InputVenueMessageContent extends InlineEntity implements InputMessageContent
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Keyboard.php b/vendor/longman/telegram-bot/src/Entities/Keyboard.php
new file mode 100644
index 0000000..237d794
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Keyboard.php
@@ -0,0 +1,226 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * Written by Marco Boretto
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+use Longman\TelegramBot\Exception\TelegramException;
+
+/**
+ * Class Keyboard
+ *
+ * @link https://core.telegram.org/bots/api#replykeyboardmarkup
+ *
+ * @method bool getResizeKeyboard() Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
+ * @method bool getOneTimeKeyboard() Optional. Requests clients to remove the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
+ * @method bool getSelective() Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
+ *
+ * @method $this setResizeKeyboard(bool $resize_keyboard) Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
+ * @method $this setOneTimeKeyboard(bool $one_time_keyboard) Optional. Requests clients to remove the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
+ * @method $this setSelective(bool $selective) Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
+ */
+class Keyboard extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function __construct($data = [])
+ {
+ $data = call_user_func_array([$this, 'createFromParams'], func_get_args());
+ parent::__construct($data);
+
+ // Remove any empty buttons.
+ $this->{$this->getKeyboardType()} = array_filter($this->{$this->getKeyboardType()});
+ }
+
+ /**
+ * If this keyboard is an inline keyboard.
+ *
+ * @return bool
+ */
+ public function isInlineKeyboard()
+ {
+ return $this instanceof InlineKeyboard;
+ }
+
+ /**
+ * Get the proper keyboard button class for this keyboard.
+ *
+ * @return KeyboardButton|InlineKeyboardButton
+ */
+ public function getKeyboardButtonClass()
+ {
+ return $this->isInlineKeyboard() ? InlineKeyboardButton::class : KeyboardButton::class;
+ }
+
+ /**
+ * Get the type of keyboard, either "inline_keyboard" or "keyboard".
+ *
+ * @return string
+ */
+ public function getKeyboardType()
+ {
+ return $this->isInlineKeyboard() ? 'inline_keyboard' : 'keyboard';
+ }
+
+ /**
+ * If no explicit keyboard is passed, try to create one from the parameters.
+ *
+ * @return array
+ */
+ protected function createFromParams()
+ {
+ $keyboard_type = $this->getKeyboardType();
+
+ $args = func_get_args();
+
+ // Force button parameters into individual rows.
+ foreach ($args as &$arg) {
+ !is_array($arg) && $arg = [$arg];
+ }
+ unset($arg);
+
+ $data = reset($args);
+
+ if ($from_data = array_key_exists($keyboard_type, (array) $data)) {
+ $args = $data[$keyboard_type];
+
+ // Make sure we're working with a proper row.
+ if (!is_array($args)) {
+ $args = [];
+ }
+ }
+
+ $new_keyboard = [];
+ foreach ($args as $row) {
+ $new_keyboard[] = $this->parseRow($row);
+ }
+
+ if (!empty($new_keyboard)) {
+ if (!$from_data) {
+ $data = [];
+ }
+ $data[$keyboard_type] = $new_keyboard;
+ }
+
+ return $data;
+ }
+
+ /**
+ * Create a new row in keyboard and add buttons.
+ *
+ * @return $this
+ */
+ public function addRow()
+ {
+ if (($new_row = $this->parseRow(func_get_args())) !== null) {
+ $this->{$this->getKeyboardType()}[] = $new_row;
+ }
+
+ return $this;
+ }
+
+ /**
+ * Parse a given row to the correct array format.
+ *
+ * @param array $row
+ *
+ * @return array
+ */
+ protected function parseRow($row)
+ {
+ if (!is_array($row)) {
+ return null;
+ }
+
+ $new_row = [];
+ foreach ($row as $button) {
+ if (($new_button = $this->parseButton($button)) !== null) {
+ $new_row[] = $new_button;
+ }
+ }
+
+ return $new_row;
+ }
+
+ /**
+ * Parse a given button to the correct KeyboardButton object type.
+ *
+ * @param array|string|\Longman\TelegramBot\Entities\KeyboardButton $button
+ *
+ * @return \Longman\TelegramBot\Entities\KeyboardButton|null
+ */
+ protected function parseButton($button)
+ {
+ $button_class = $this->getKeyboardButtonClass();
+
+ if ($button instanceof $button_class) {
+ return $button;
+ }
+
+ if (!$this->isInlineKeyboard() || $button_class::couldBe($button)) {
+ return new $button_class($button);
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function validate()
+ {
+ $keyboard_type = $this->getKeyboardType();
+ $keyboard = $this->getProperty($keyboard_type);
+
+ if ($keyboard !== null) {
+ if (!is_array($keyboard)) {
+ throw new TelegramException($keyboard_type . ' field is not an array!');
+ }
+
+ foreach ($keyboard as $item) {
+ if (!is_array($item)) {
+ throw new TelegramException($keyboard_type . ' subfield is not an array!');
+ }
+ }
+ }
+ }
+
+ /**
+ * Remove the current custom keyboard and display the default letter-keyboard.
+ *
+ * @link https://core.telegram.org/bots/api/#replykeyboardremove
+ *
+ * @param array $data
+ *
+ * @return \Longman\TelegramBot\Entities\Keyboard
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public static function remove(array $data = [])
+ {
+ return new static(array_merge(['keyboard' => [], 'remove_keyboard' => true, 'selective' => false], $data));
+ }
+
+ /**
+ * Display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply').
+ *
+ * @link https://core.telegram.org/bots/api#forcereply
+ *
+ * @param array $data
+ *
+ * @return \Longman\TelegramBot\Entities\Keyboard
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public static function forceReply(array $data = [])
+ {
+ return new static(array_merge(['keyboard' => [], 'force_reply' => true, 'selective' => false], $data));
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/KeyboardButton.php b/vendor/longman/telegram-bot/src/Entities/KeyboardButton.php
new file mode 100644
index 0000000..a7fb7ad
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/KeyboardButton.php
@@ -0,0 +1,79 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+use Longman\TelegramBot\Exception\TelegramException;
+
+/**
+ * Class KeyboardButton
+ *
+ * @link https://core.telegram.org/bots/api#keyboardbutton
+ *
+ * @method string getText() Text of the button. If none of the optional fields are used, it will be sent to the bot as a message when the button is pressed
+ * @method bool getRequestContact() Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only
+ * @method bool getRequestLocation() Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only
+ *
+ * @method $this setText(string $text) Text of the button. If none of the optional fields are used, it will be sent to the bot as a message when the button is pressed
+ * @method $this setRequestContact(bool $request_contact) Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only
+ * @method $this setRequestLocation(bool $request_location) Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only
+ */
+class KeyboardButton extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function __construct($data)
+ {
+ if (is_string($data)) {
+ $data = ['text' => $data];
+ }
+ parent::__construct($data);
+ }
+
+ /**
+ * Check if the passed data array could be a KeyboardButton.
+ *
+ * @param array $data
+ *
+ * @return bool
+ */
+ public static function couldBe($data)
+ {
+ return is_array($data) && array_key_exists('text', $data);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function validate()
+ {
+ if ($this->getProperty('text', '') === '') {
+ throw new TelegramException('You must add some text to the button!');
+ }
+
+ if ($this->getRequestContact() && $this->getRequestLocation()) {
+ throw new TelegramException('You must use only one of these fields: request_contact, request_location!');
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function __call($method, $args)
+ {
+ // Only 1 of these can be set, so clear the others when setting a new one.
+ if (in_array($method, ['setRequestContact', 'setRequestLocation'], true)) {
+ unset($this->request_contact, $this->request_location);
+ }
+
+ return parent::__call($method, $args);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Location.php b/vendor/longman/telegram-bot/src/Entities/Location.php
new file mode 100644
index 0000000..c9340bc
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Location.php
@@ -0,0 +1,24 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class Location
+ *
+ * @link https://core.telegram.org/bots/api#location
+ *
+ * @method float getLongitude() Longitude as defined by sender
+ * @method float getLatitude() Latitude as defined by sender
+ */
+class Location extends Entity
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/MaskPosition.php b/vendor/longman/telegram-bot/src/Entities/MaskPosition.php
new file mode 100644
index 0000000..d28af41
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/MaskPosition.php
@@ -0,0 +1,26 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class MaskPosition
+ *
+ * @link https://core.telegram.org/bots/api#maskposition
+ *
+ * @method string getPoint() The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”.
+ * @method float getXShift() Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position.
+ * @method float getYShift() Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position.
+ * @method float getScale() Mask scaling coefficient. For example, 2.0 means double size.
+ */
+class MaskPosition extends Entity
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Message.php b/vendor/longman/telegram-bot/src/Entities/Message.php
new file mode 100644
index 0000000..3fc1da1
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Message.php
@@ -0,0 +1,314 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+use Longman\TelegramBot\Entities\Payments\Invoice;
+use Longman\TelegramBot\Entities\Payments\SuccessfulPayment;
+
+/**
+ * Class Message
+ *
+ * @link https://core.telegram.org/bots/api#message
+ *
+ * @method int getMessageId() Unique message identifier
+ * @method User getFrom() Optional. Sender, can be empty for messages sent to channels
+ * @method int getDate() Date the message was sent in Unix time
+ * @method Chat getChat() Conversation the message belongs to
+ * @method User getForwardFrom() Optional. For forwarded messages, sender of the original message
+ * @method Chat getForwardFromChat() Optional. For messages forwarded from a channel, information about the original channel
+ * @method int getForwardFromMessageId() Optional. For forwarded channel posts, identifier of the original message in the channel
+ * @method string getForwardSignature() Optional. For messages forwarded from channels, signature of the post author if present
+ * @method int getForwardDate() Optional. For forwarded messages, date the original message was sent in Unix time
+ * @method Message getReplyToMessage() Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
+ * @method int getEditDate() Optional. Date the message was last edited in Unix time
+ * @method string getMediaGroupId() Optional. The unique identifier of a media message group this message belongs to
+ * @method string getAuthorSignature() Optional. Signature of the post author for messages in channels
+ * @method Audio getAudio() Optional. Message is an audio file, information about the file
+ * @method Document getDocument() Optional. Message is a general file, information about the file
+ * @method Sticker getSticker() Optional. Message is a sticker, information about the sticker
+ * @method Video getVideo() Optional. Message is a video, information about the video
+ * @method Voice getVoice() Optional. Message is a voice message, information about the file
+ * @method VideoNote getVideoNote() Optional. Message is a video note message, information about the video
+ * @method string getCaption() Optional. Caption for the document, photo or video, 0-200 characters
+ * @method Contact getContact() Optional. Message is a shared contact, information about the contact
+ * @method Location getLocation() Optional. Message is a shared location, information about the location
+ * @method Venue getVenue() Optional. Message is a venue, information about the venue
+ * @method User getLeftChatMember() Optional. A member was removed from the group, information about them (this member may be the bot itself)
+ * @method string getNewChatTitle() Optional. A chat title was changed to this value
+ * @method bool getDeleteChatPhoto() Optional. Service message: the chat photo was deleted
+ * @method bool getGroupChatCreated() Optional. Service message: the group has been created
+ * @method bool getSupergroupChatCreated() Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can’t be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.
+ * @method bool getChannelChatCreated() Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can’t be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.
+ * @method int getMigrateToChatId() Optional. The group has been migrated to a supergroup with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
+ * @method int getMigrateFromChatId() Optional. The supergroup has been migrated from a group with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
+ * @method Message getPinnedMessage() Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.
+ * @method Invoice getInvoice() Optional. Message is an invoice for a payment, information about the invoice.
+ * @method SuccessfulPayment getSuccessfulPayment() Optional. Message is a service message about a successful payment, information about the payment.
+ */
+class Message extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ protected function subEntities()
+ {
+ return [
+ 'from' => User::class,
+ 'chat' => Chat::class,
+ 'forward_from' => User::class,
+ 'forward_from_chat' => Chat::class,
+ 'reply_to_message' => ReplyToMessage::class,
+ 'entities' => MessageEntity::class,
+ 'caption_entities' => MessageEntity::class,
+ 'audio' => Audio::class,
+ 'document' => Document::class,
+ 'photo' => PhotoSize::class,
+ 'sticker' => Sticker::class,
+ 'video' => Video::class,
+ 'voice' => Voice::class,
+ 'video_note' => VideoNote::class,
+ 'contact' => Contact::class,
+ 'location' => Location::class,
+ 'venue' => Venue::class,
+ 'new_chat_members' => User::class,
+ 'left_chat_member' => User::class,
+ 'new_chat_photo' => PhotoSize::class,
+ 'pinned_message' => Message::class,
+ 'invoice' => Invoice::class,
+ 'successful_payment' => SuccessfulPayment::class,
+ ];
+ }
+
+ /**
+ * Message constructor
+ *
+ * @param array $data
+ * @param string $bot_username
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data, $bot_username = '')
+ {
+ parent::__construct($data, $bot_username);
+ }
+
+ /**
+ * Optional. Message is a photo, available sizes of the photo
+ *
+ * This method overrides the default getPhoto method
+ * and returns a nice array of PhotoSize objects.
+ *
+ * @return null|PhotoSize[]
+ */
+ public function getPhoto()
+ {
+ $pretty_array = $this->makePrettyObjectArray(PhotoSize::class, 'photo');
+
+ return empty($pretty_array) ? null : $pretty_array;
+ }
+
+ /**
+ * Optional. A chat photo was changed to this value
+ *
+ * This method overrides the default getNewChatPhoto method
+ * and returns a nice array of PhotoSize objects.
+ *
+ * @return null|PhotoSize[]
+ */
+ public function getNewChatPhoto()
+ {
+ $pretty_array = $this->makePrettyObjectArray(PhotoSize::class, 'new_chat_photo');
+
+ return empty($pretty_array) ? null : $pretty_array;
+ }
+
+ /**
+ * Optional. A new member(s) was added to the group, information about them (one of this members may be the bot itself)
+ *
+ * This method overrides the default getNewChatMembers method
+ * and returns a nice array of User objects.
+ *
+ * @return null|User[]
+ */
+ public function getNewChatMembers()
+ {
+ $pretty_array = $this->makePrettyObjectArray(User::class, 'new_chat_members');
+
+ return empty($pretty_array) ? null : $pretty_array;
+ }
+
+ /**
+ * Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
+ *
+ * This method overrides the default getEntities method
+ * and returns a nice array of MessageEntity objects.
+ *
+ * @return null|MessageEntity[]
+ */
+ public function getEntities()
+ {
+ $pretty_array = $this->makePrettyObjectArray(MessageEntity::class, 'entities');
+
+ return empty($pretty_array) ? null : $pretty_array;
+ }
+
+ /**
+ * Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
+ *
+ * This method overrides the default getCaptionEntities method
+ * and returns a nice array of MessageEntity objects.
+ *
+ * @return null|MessageEntity[]
+ */
+ public function getCaptionEntities()
+ {
+ $pretty_array = $this->makePrettyObjectArray(MessageEntity::class, 'caption_entities');
+
+ return empty($pretty_array) ? null : $pretty_array;
+ }
+
+ /**
+ * return the entire command like /echo or /echo@bot1 if specified
+ *
+ * @return string|null
+ */
+ public function getFullCommand()
+ {
+ $text = $this->getProperty('text');
+ if (strpos($text, '/') !== 0) {
+ return null;
+ }
+
+ $no_EOL = strtok($text, PHP_EOL);
+ $no_space = strtok($text, ' ');
+
+ //try to understand which separator \n or space divide /command from text
+ return strlen($no_space) < strlen($no_EOL) ? $no_space : $no_EOL;
+ }
+
+ /**
+ * Get command
+ *
+ * @return string|null
+ */
+ public function getCommand()
+ {
+ if ($command = $this->getProperty('command')) {
+ return $command;
+ }
+
+ $full_command = $this->getFullCommand();
+ if (strpos($full_command, '/') !== 0) {
+ return null;
+ }
+ $full_command = substr($full_command, 1);
+
+ //check if command is followed by bot username
+ $split_cmd = explode('@', $full_command);
+ if (!isset($split_cmd[1])) {
+ //command is not followed by name
+ return $full_command;
+ }
+
+ if (strtolower($split_cmd[1]) === strtolower($this->getBotUsername())) {
+ //command is addressed to me
+ return $split_cmd[0];
+ }
+
+ return null;
+ }
+
+ /**
+ * For text messages, the actual UTF-8 text of the message, 0-4096 characters.
+ *
+ * @param bool $without_cmd
+ *
+ * @return string
+ */
+ public function getText($without_cmd = false)
+ {
+ $text = $this->getProperty('text');
+
+ if ($without_cmd && $command = $this->getFullCommand()) {
+ if (strlen($command) + 1 < strlen($text)) {
+ return substr($text, strlen($command) + 1);
+ }
+
+ return '';
+ }
+
+ return $text;
+ }
+
+ /**
+ * Bot added in chat
+ *
+ * @return bool
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function botAddedInChat()
+ {
+ foreach ($this->getNewChatMembers() as $member) {
+ if ($member instanceof User && $member->getUsername() === $this->getBotUsername()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Detect type based on properties.
+ *
+ * @return string
+ */
+ public function getType()
+ {
+ $types = [
+ 'text',
+ 'audio',
+ 'document',
+ 'photo',
+ 'sticker',
+ 'video',
+ 'voice',
+ 'contact',
+ 'location',
+ 'venue',
+ 'new_chat_members',
+ 'left_chat_member',
+ 'new_chat_title',
+ 'new_chat_photo',
+ 'delete_chat_photo',
+ 'group_chat_created',
+ 'supergroup_chat_created',
+ 'channel_chat_created',
+ 'migrate_to_chat_id',
+ 'migrate_from_chat_id',
+ 'pinned_message',
+ 'invoice',
+ 'successful_payment',
+ ];
+
+ $is_command = strlen($this->getCommand()) > 0;
+ foreach ($types as $type) {
+ if ($this->getProperty($type)) {
+ if ($is_command && $type === 'text') {
+ return 'command';
+ }
+
+ return $type;
+ }
+ }
+
+ return 'message';
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/MessageEntity.php b/vendor/longman/telegram-bot/src/Entities/MessageEntity.php
new file mode 100644
index 0000000..7ab9c59
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/MessageEntity.php
@@ -0,0 +1,35 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class MessageEntity
+ *
+ * @link https://core.telegram.org/bots/api#messageentity
+ *
+ * @method string getType() Type of the entity. Can be mention (@username), hashtag, bot_command, url, email, bold (bold text), italic (italic text), code (monowidth string), pre (monowidth block), text_link (for clickable text URLs), text_mention (for users without usernames)
+ * @method int getOffset() Offset in UTF-16 code units to the start of the entity
+ * @method int getLength() Length of the entity in UTF-16 code units
+ * @method string getUrl() Optional. For "text_link" only, url that will be opened after user taps on the text
+ * @method User getUser() Optional. For "text_mention" only, the mentioned user
+ */
+class MessageEntity extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ protected function subEntities()
+ {
+ return [
+ 'user' => User::class,
+ ];
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Payments/Invoice.php b/vendor/longman/telegram-bot/src/Entities/Payments/Invoice.php
new file mode 100644
index 0000000..2208ed6
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Payments/Invoice.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\Payments;
+
+use Longman\TelegramBot\Entities\Entity;
+
+/**
+ * Class Invoice
+ *
+ * This object contains basic information about an invoice.
+ *
+ * @link https://core.telegram.org/bots/api#invoice
+ *
+ * @method string getTitle() Product name
+ * @method string getDescription() Product description
+ * @method string getStartParameter() Unique bot deep-linking parameter that can be used to generate this invoice
+ * @method string getCurrency() Three-letter ISO 4217 currency code
+ * @method int getTotalAmount() Total price in the smallest units of the currency (integer, not float/double).
+ **/
+class Invoice extends Entity
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Payments/LabeledPrice.php b/vendor/longman/telegram-bot/src/Entities/Payments/LabeledPrice.php
new file mode 100644
index 0000000..b22da76
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Payments/LabeledPrice.php
@@ -0,0 +1,28 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\Payments;
+
+use Longman\TelegramBot\Entities\Entity;
+
+/**
+ * Class LabeledPrice
+ *
+ * This object represents a portion of the price for goods or services.
+ *
+ * @link https://core.telegram.org/bots/api#labeledprice
+ *
+ * @method string getLabel() Portion label
+ * @method int getAmount() Price of the product in the smallest units of the currency (integer, not float/double).
+ **/
+class LabeledPrice extends Entity
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Payments/OrderInfo.php b/vendor/longman/telegram-bot/src/Entities/Payments/OrderInfo.php
new file mode 100644
index 0000000..f57c81b
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Payments/OrderInfo.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\Payments;
+
+use Longman\TelegramBot\Entities\Entity;
+
+/**
+ * Class OrderInfo
+ *
+ * This object represents information about an order.
+ *
+ * @link https://core.telegram.org/bots/api#orderinfo
+ *
+ * @method string getName() Optional. User name
+ * @method string getPhoneNumber() Optional. User's phone number
+ * @method string getEmail() Optional. User email
+ * @method ShippingAddress getShippingAddress() Optional. User shipping address
+ **/
+class OrderInfo extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function subEntities()
+ {
+ return [
+ 'shipping_address' => ShippingAddress::class,
+ ];
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Payments/PreCheckoutQuery.php b/vendor/longman/telegram-bot/src/Entities/Payments/PreCheckoutQuery.php
new file mode 100644
index 0000000..6acd90e
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Payments/PreCheckoutQuery.php
@@ -0,0 +1,60 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\Payments;
+
+use Longman\TelegramBot\Entities\Entity;
+use Longman\TelegramBot\Entities\User;
+use Longman\TelegramBot\Request;
+
+/**
+ * Class PreCheckoutQuery
+ *
+ * This object contains information about an incoming pre-checkout query.
+ *
+ * @link https://core.telegram.org/bots/api#precheckoutquery
+ *
+ * @method string getId() Unique query identifier
+ * @method User getFrom() User who sent the query
+ * @method string getCurrency() Three-letter ISO 4217 currency code
+ * @method int getTotalAmount() Total price in the smallest units of the currency (integer, not float/double).
+ * @method string getInvoicePayload() Bot specified invoice payload
+ * @method string getShippingOptionId() Optional. Identifier of the shipping option chosen by the user
+ * @method OrderInfo getOrderInfo() Optional. Order info provided by the user
+ **/
+class PreCheckoutQuery extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function subEntities()
+ {
+ return [
+ 'user' => User::class,
+ 'order_info' => OrderInfo::class,
+ ];
+ }
+
+ /**
+ * Answer this pre-checkout query.
+ *
+ * @param bool $ok
+ * @param array $data
+ *
+ * @return \Longman\TelegramBot\Entities\ServerResponse
+ */
+ public function answer($ok, array $data = [])
+ {
+ return Request::answerPreCheckoutQuery(array_merge([
+ 'pre_checkout_query_id' => $this->getId(),
+ 'ok' => $ok,
+ ], $data));
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Payments/ShippingAddress.php b/vendor/longman/telegram-bot/src/Entities/Payments/ShippingAddress.php
new file mode 100644
index 0000000..e0a21f6
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Payments/ShippingAddress.php
@@ -0,0 +1,32 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\Payments;
+
+use Longman\TelegramBot\Entities\Entity;
+
+/**
+ * Class ShippingAddress
+ *
+ * This object represents a shipping address.
+ *
+ * @link https://core.telegram.org/bots/api#shippingaddress
+ *
+ * @method string getCountryCode() ISO 3166-1 alpha-2 country code
+ * @method string getState() State, if applicable
+ * @method string getCity() City
+ * @method string getStreetLine1() First line for the address
+ * @method string getStreetLine2() Second line for the address
+ * @method string getPostCode() Address post code
+ **/
+class ShippingAddress extends Entity
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Payments/ShippingOption.php b/vendor/longman/telegram-bot/src/Entities/Payments/ShippingOption.php
new file mode 100644
index 0000000..39fd0cd
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Payments/ShippingOption.php
@@ -0,0 +1,60 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\Payments;
+
+use Longman\TelegramBot\Entities\Entity;
+
+/**
+ * Class ShippingOption
+ *
+ * This object represents one shipping option.
+ *
+ * @link https://core.telegram.org/bots/api#shippingoption
+ *
+ * @method string getId() Shipping option identifier
+ * @method string getTitle() Option title
+ **/
+class ShippingOption extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ protected function subEntities()
+ {
+ return [
+ 'prices' => LabeledPrice::class,
+ ];
+ }
+
+ /**
+ * List of price portions
+ *
+ * This method overrides the default getPrices method and returns a nice array
+ *
+ * @return LabeledPrice[]
+ */
+ public function getPrices()
+ {
+ $all_prices = [];
+
+ if ($these_prices = $this->getProperty('prices')) {
+ foreach ($these_prices as $prices) {
+ $new_prices = [];
+ foreach ($prices as $price) {
+ $new_prices[] = new LabeledPrice($price);
+ }
+ $all_prices[] = $new_prices;
+ }
+ }
+
+ return $all_prices;
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Payments/ShippingQuery.php b/vendor/longman/telegram-bot/src/Entities/Payments/ShippingQuery.php
new file mode 100644
index 0000000..a2395b9
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Payments/ShippingQuery.php
@@ -0,0 +1,57 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\Payments;
+
+use Longman\TelegramBot\Entities\Entity;
+use Longman\TelegramBot\Entities\User;
+use Longman\TelegramBot\Request;
+
+/**
+ * Class ShippingQuery
+ *
+ * This object contains information about an incoming shipping query.
+ *
+ * @link https://core.telegram.org/bots/api#shippingquery
+ *
+ * @method string getId() Unique query identifier
+ * @method User getFrom() User who sent the query
+ * @method string getInvoicePayload() Bot specified invoice payload
+ * @method ShippingAddress getShippingAddress() User specified shipping address
+ **/
+class ShippingQuery extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function subEntities()
+ {
+ return [
+ 'user' => User::class,
+ 'shipping_address' => ShippingAddress::class,
+ ];
+ }
+
+ /**
+ * Answer this shipping query.
+ *
+ * @param bool $ok
+ * @param array $data
+ *
+ * @return \Longman\TelegramBot\Entities\ServerResponse
+ */
+ public function answer($ok, array $data = [])
+ {
+ return Request::answerShippingQuery(array_merge([
+ 'shipping_query_id' => $this->getId(),
+ 'ok' => $ok,
+ ], $data));
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Payments/SuccessfulPayment.php b/vendor/longman/telegram-bot/src/Entities/Payments/SuccessfulPayment.php
new file mode 100644
index 0000000..67e762b
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Payments/SuccessfulPayment.php
@@ -0,0 +1,41 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities\Payments;
+
+use Longman\TelegramBot\Entities\Entity;
+
+/**
+ * Class SuccessfulPayment
+ *
+ * This object contains basic information about a successful payment.
+ *
+ * @link https://core.telegram.org/bots/api#successfulpayment
+ *
+ * @method string getCurrency() Three-letter ISO 4217 currency code
+ * @method int getTotalAmount() Total price in the smallest units of the currency (integer, not float/double).
+ * @method string getInvoicePayload() Bot specified invoice payload
+ * @method string getShippingOptionId() Optional. Identifier of the shipping option chosen by the user
+ * @method OrderInfo getOrderInfo() Optional. Order info provided by the user
+ * @method string getTelegramPaymentChargeId() Telegram payment identifier
+ * @method string getProviderPaymentChargeId() Provider payment identifier
+ **/
+class SuccessfulPayment extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function subEntities()
+ {
+ return [
+ 'order_info' => OrderInfo::class,
+ ];
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/PhotoSize.php b/vendor/longman/telegram-bot/src/Entities/PhotoSize.php
new file mode 100644
index 0000000..5b577af
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/PhotoSize.php
@@ -0,0 +1,26 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class PhotoSize
+ *
+ * @link https://core.telegram.org/bots/api#photosize
+ *
+ * @method string getFileId() Unique identifier for this file
+ * @method int getWidth() Photo width
+ * @method int getHeight() Photo height
+ * @method int getFileSize() Optional. File size
+ */
+class PhotoSize extends Entity
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/ReplyToMessage.php b/vendor/longman/telegram-bot/src/Entities/ReplyToMessage.php
new file mode 100644
index 0000000..d35f63f
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/ReplyToMessage.php
@@ -0,0 +1,36 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class ReplyToMessage
+ *
+ * @todo Is this even required?!
+ */
+class ReplyToMessage extends Message
+{
+ /**
+ * ReplyToMessage constructor.
+ *
+ * @param array $data
+ * @param string $bot_username
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data, $bot_username = '')
+ {
+ //As explained in the documentation
+ //Reply to message can't contain other reply to message entities
+ unset($data['reply_to_message']);
+
+ parent::__construct($data, $bot_username);
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/ServerResponse.php b/vendor/longman/telegram-bot/src/Entities/ServerResponse.php
new file mode 100644
index 0000000..b573e9f
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/ServerResponse.php
@@ -0,0 +1,165 @@
+
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class ServerResponse
+ *
+ * @link https://core.telegram.org/bots/api#making-requests
+ *
+ * @method bool getOk() If the request was successful
+ * @method mixed getResult() The result of the query
+ * @method int getErrorCode() Error code of the unsuccessful request
+ * @method string getDescription() Human-readable description of the result / unsuccessful request
+ *
+ * @todo method ResponseParameters getParameters() Field which can help to automatically handle the error
+ */
+class ServerResponse extends Entity
+{
+ /**
+ * ServerResponse constructor.
+ *
+ * @param array $data
+ * @param string $bot_username
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct(array $data, $bot_username)
+ {
+ // Make sure we don't double-save the raw_data
+ unset($data['raw_data']);
+ $data['raw_data'] = $data;
+
+ $is_ok = isset($data['ok']) ? (bool) $data['ok'] : false;
+ $result = isset($data['result']) ? $data['result'] : null;
+
+ if ($is_ok && is_array($result)) {
+ if ($this->isAssoc($result)) {
+ $data['result'] = $this->createResultObject($result, $bot_username);
+ } else {
+ $data['result'] = $this->createResultObjects($result, $bot_username);
+ }
+ }
+
+ parent::__construct($data, $bot_username);
+ }
+
+ /**
+ * Check if array is associative
+ *
+ * @link https://stackoverflow.com/a/4254008
+ *
+ * @param array $array
+ *
+ * @return bool
+ */
+ protected function isAssoc(array $array)
+ {
+ return count(array_filter(array_keys($array), 'is_string')) > 0;
+ }
+
+ /**
+ * If response is ok
+ *
+ * @return bool
+ */
+ public function isOk()
+ {
+ return (bool) $this->getOk();
+ }
+
+ /**
+ * Print error
+ *
+ * @see https://secure.php.net/manual/en/function.print-r.php
+ *
+ * @param bool $return
+ *
+ * @return bool|string
+ */
+ public function printError($return = false)
+ {
+ $error = sprintf('Error N: %s, Description: %s', $this->getErrorCode(), $this->getDescription());
+
+ if ($return) {
+ return $error;
+ }
+
+ echo $error;
+
+ return true;
+ }
+
+ /**
+ * Create and return the object of the received result
+ *
+ * @param array $result
+ * @param string $bot_username
+ *
+ * @return \Longman\TelegramBot\Entities\Chat|\Longman\TelegramBot\Entities\ChatMember|\Longman\TelegramBot\Entities\File|\Longman\TelegramBot\Entities\Message|\Longman\TelegramBot\Entities\User|\Longman\TelegramBot\Entities\UserProfilePhotos|\Longman\TelegramBot\Entities\WebhookInfo
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ private function createResultObject($result, $bot_username)
+ {
+ // We don't need to save the raw_data of the response object!
+ $result['raw_data'] = null;
+
+ $result_object_types = [
+ 'total_count' => 'UserProfilePhotos', //Response from getUserProfilePhotos
+ 'file_id' => 'File', //Response from getFile
+ 'title' => 'Chat', //Response from getChat
+ 'username' => 'User', //Response from getMe
+ 'user' => 'ChatMember', //Response from getChatMember
+ 'url' => 'WebhookInfo', //Response from getWebhookInfo
+ ];
+ foreach ($result_object_types as $type => $object_class) {
+ if (isset($result[$type])) {
+ $object_class = __NAMESPACE__ . '\\' . $object_class;
+
+ return new $object_class($result);
+ }
+ }
+
+ //Response from sendMessage
+ return new Message($result, $bot_username);
+ }
+
+ /**
+ * Create and return the objects array of the received result
+ *
+ * @param array $result
+ * @param string $bot_username
+ *
+ * @return null|\Longman\TelegramBot\Entities\ChatMember[]|\Longman\TelegramBot\Entities\Update[]
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ private function createResultObjects($result, $bot_username)
+ {
+ $results = [];
+ if (isset($result[0]['user'])) {
+ //Response from getChatAdministrators
+ foreach ($result as $user) {
+ // We don't need to save the raw_data of the response object!
+ $user['raw_data'] = null;
+
+ $results[] = new ChatMember($user);
+ }
+ } else {
+ //Get Update
+ foreach ($result as $update) {
+ // We don't need to save the raw_data of the response object!
+ $update['raw_data'] = null;
+
+ $results[] = new Update($update, $bot_username);
+ }
+ }
+
+ return $results;
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Sticker.php b/vendor/longman/telegram-bot/src/Entities/Sticker.php
new file mode 100644
index 0000000..cb5d573
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Sticker.php
@@ -0,0 +1,39 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class Sticker
+ *
+ * @link https://core.telegram.org/bots/api#sticker
+ *
+ * @method string getFileId() Unique identifier for this file
+ * @method int getWidth() Sticker width
+ * @method int getHeight() Sticker height
+ * @method PhotoSize getThumb() Optional. Sticker thumbnail in .webp or .jpg format
+ * @method string getEmoji() Optional. Emoji associated with the sticker
+ * @method string getSetName() Optional. Name of the sticker set to which the sticker belongs
+ * @method MaskPosition getMaskPosition() Optional. For mask stickers, the position where the mask should be placed
+ * @method int getFileSize() Optional. File size
+ */
+class Sticker extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ protected function subEntities()
+ {
+ return [
+ 'thumb' => PhotoSize::class,
+ 'mask_position' => MaskPosition::class,
+ ];
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/StickerSet.php b/vendor/longman/telegram-bot/src/Entities/StickerSet.php
new file mode 100644
index 0000000..cba3204
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/StickerSet.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class StickerSet
+ *
+ * @link https://core.telegram.org/bots/api#stickerset
+ *
+ * @method string getName() Sticker set name
+ * @method string getTitle() Sticker set title
+ * @method bool getContainsMasks() True, if the sticker set contains masks
+ */
+class StickerSet extends Entity
+{
+ /**
+ * List of all set stickers
+ *
+ * This method overrides the default getStickers method
+ * and returns a nice array of Sticker objects.
+ *
+ * @return null|Sticker[]
+ */
+ public function getStickers()
+ {
+ $pretty_array = $this->makePrettyObjectArray(Sticker::class, 'stickers');
+
+ return empty($pretty_array) ? null : $pretty_array;
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Update.php b/vendor/longman/telegram-bot/src/Entities/Update.php
new file mode 100644
index 0000000..4ddb64b
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Update.php
@@ -0,0 +1,98 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+use Longman\TelegramBot\Entities\Payments\PreCheckoutQuery;
+use Longman\TelegramBot\Entities\Payments\ShippingQuery;
+
+/**
+ * Class Update
+ *
+ * @link https://core.telegram.org/bots/api#update
+ *
+ * @method int getUpdateId() The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you’re using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order.
+ * @method Message getMessage() Optional. New incoming message of any kind — text, photo, sticker, etc.
+ * @method Message getEditedMessage() Optional. New version of a message that is known to the bot and was edited
+ * @method Message getChannelPost() Optional. New post in the channel, can be any kind — text, photo, sticker, etc.
+ * @method Message getEditedChannelPost() Optional. New version of a post in the channel that is known to the bot and was edited
+ * @method InlineQuery getInlineQuery() Optional. New incoming inline query
+ * @method ChosenInlineResult getChosenInlineResult() Optional. The result of an inline query that was chosen by a user and sent to their chat partner.
+ * @method CallbackQuery getCallbackQuery() Optional. New incoming callback query
+ * @method ShippingQuery getShippingQuery() Optional. New incoming shipping query. Only for invoices with flexible price
+ * @method PreCheckoutQuery getPreCheckoutQuery() Optional. New incoming pre-checkout query. Contains full information about checkout
+ */
+class Update extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ protected function subEntities()
+ {
+ return [
+ 'message' => Message::class,
+ 'edited_message' => EditedMessage::class,
+ 'channel_post' => ChannelPost::class,
+ 'edited_channel_post' => EditedChannelPost::class,
+ 'inline_query' => InlineQuery::class,
+ 'chosen_inline_result' => ChosenInlineResult::class,
+ 'callback_query' => CallbackQuery::class,
+ 'shipping_query' => ShippingQuery::class,
+ 'pre_checkout_query' => PreCheckoutQuery::class,
+ ];
+ }
+
+ /**
+ * Get the update type based on the set properties
+ *
+ * @return string|null
+ */
+ public function getUpdateType()
+ {
+ $types = [
+ 'message',
+ 'edited_message',
+ 'channel_post',
+ 'edited_channel_post',
+ 'inline_query',
+ 'chosen_inline_result',
+ 'callback_query',
+ 'shipping_query',
+ 'pre_checkout_query',
+ ];
+ foreach ($types as $type) {
+ if ($this->getProperty($type)) {
+ return $type;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Get update content
+ *
+ * @return \Longman\TelegramBot\Entities\CallbackQuery
+ * |\Longman\TelegramBot\Entities\ChosenInlineResult
+ * |\Longman\TelegramBot\Entities\InlineQuery
+ * |\Longman\TelegramBot\Entities\Message
+ */
+ public function getUpdateContent()
+ {
+ if ($update_type = $this->getUpdateType()) {
+ // Instead of just getting the property as an array,
+ // use the __call method to get the correct Entity object.
+ $method = 'get' . str_replace('_', '', ucwords($update_type, '_'));
+ return $this->$method();
+ }
+
+ return null;
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/User.php b/vendor/longman/telegram-bot/src/Entities/User.php
new file mode 100644
index 0000000..de5ad1f
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/User.php
@@ -0,0 +1,28 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class User
+ *
+ * @link https://core.telegram.org/bots/api#user
+ *
+ * @method int getId() Unique identifier for this user or bot
+ * @method bool getIsBot() True, if this user is a bot
+ * @method string getFirstName() User's or bot’s first name
+ * @method string getLastName() Optional. User's or bot’s last name
+ * @method string getUsername() Optional. User's or bot’s username
+ * @method string getLanguageCode() Optional. User's system language
+ */
+class User extends Entity
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/UserProfilePhotos.php b/vendor/longman/telegram-bot/src/Entities/UserProfilePhotos.php
new file mode 100644
index 0000000..29c3d4d
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/UserProfilePhotos.php
@@ -0,0 +1,55 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class UserProfilePhotos
+ *
+ * @link https://core.telegram.org/bots/api#userprofilephotos
+ *
+ * @method int getTotalCount() Total number of profile pictures the target user has
+ */
+class UserProfilePhotos extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ protected function subEntities()
+ {
+ return [
+ 'photos' => PhotoSize::class,
+ ];
+ }
+
+ /**
+ * Requested profile pictures (in up to 4 sizes each)
+ *
+ * This method overrides the default getPhotos method and returns a nice array
+ *
+ * @return PhotoSize[]
+ */
+ public function getPhotos()
+ {
+ $all_photos = [];
+
+ if ($these_photos = $this->getProperty('photos')) {
+ foreach ($these_photos as $photos) {
+ $new_photos = [];
+ foreach ($photos as $photo) {
+ $new_photos[] = new PhotoSize($photo);
+ }
+ $all_photos[] = $new_photos;
+ }
+ }
+
+ return $all_photos;
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Venue.php b/vendor/longman/telegram-bot/src/Entities/Venue.php
new file mode 100644
index 0000000..46069c0
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Venue.php
@@ -0,0 +1,34 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class Venue
+ *
+ * @link https://core.telegram.org/bots/api#venue
+ *
+ * @method Location getLocation() Venue location
+ * @method string getTitle() Name of the venue
+ * @method string getAddress() Address of the venue
+ * @method string getFoursquareId() Optional. Foursquare identifier of the venue
+ */
+class Venue extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ protected function subEntities()
+ {
+ return [
+ 'location' => Location::class,
+ ];
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Video.php b/vendor/longman/telegram-bot/src/Entities/Video.php
new file mode 100644
index 0000000..4cdc6b8
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Video.php
@@ -0,0 +1,37 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class Video
+ *
+ * @link https://core.telegram.org/bots/api#video
+ *
+ * @method string getFileId() Unique identifier for this file
+ * @method int getWidth() Video width as defined by sender
+ * @method int getHeight() Video height as defined by sender
+ * @method int getDuration() Duration of the video in seconds as defined by sender
+ * @method PhotoSize getThumb() Optional. Video thumbnail
+ * @method string getMimeType() Optional. Mime type of a file as defined by sender
+ * @method int getFileSize() Optional. File size
+ */
+class Video extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ protected function subEntities()
+ {
+ return [
+ 'thumb' => PhotoSize::class,
+ ];
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/VideoNote.php b/vendor/longman/telegram-bot/src/Entities/VideoNote.php
new file mode 100644
index 0000000..fd0d865
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/VideoNote.php
@@ -0,0 +1,35 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class VideoNote
+ *
+ * @link https://core.telegram.org/bots/api#videonote
+ *
+ * @method string getFileId() Unique identifier for this file
+ * @method int getLength() Video width and height as defined by sender
+ * @method int getDuration() Duration of the audio in seconds as defined by sender
+ * @method PhotoSize getThumb() Optional. Video thumbnail as defined by sender
+ * @method int getFileSize() Optional. File size
+ */
+class VideoNote extends Entity
+{
+ /**
+ * {@inheritdoc}
+ */
+ protected function subEntities()
+ {
+ return [
+ 'thumb' => PhotoSize::class,
+ ];
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/Voice.php b/vendor/longman/telegram-bot/src/Entities/Voice.php
new file mode 100644
index 0000000..0b422f8
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/Voice.php
@@ -0,0 +1,26 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class Voice
+ *
+ * @link https://core.telegram.org/bots/api#voice
+ *
+ * @method string getFileId() Unique identifier for this file
+ * @method int getDuration() Duration of the audio in seconds as defined by sender
+ * @method string getMimeType() Optional. MIME type of the file as defined by sender
+ * @method int getFileSize() Optional. File size
+ */
+class Voice extends Entity
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Entities/WebhookInfo.php b/vendor/longman/telegram-bot/src/Entities/WebhookInfo.php
new file mode 100644
index 0000000..104892a
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Entities/WebhookInfo.php
@@ -0,0 +1,29 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Entities;
+
+/**
+ * Class WebhookInfo
+ *
+ * @link https://core.telegram.org/bots/api#webhookinfo
+ *
+ * @method string getUrl() Webhook URL, may be empty if webhook is not set up
+ * @method bool getHasCustomCertificate() True, if a custom certificate was provided for webhook certificate checks
+ * @method int getPendingUpdateCount() Number of updates awaiting delivery
+ * @method int getLastErrorDate() Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook
+ * @method string getLastErrorMessage() Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook
+ * @method int getMaxConnections() Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery
+ * @method string[] getAllowedUpdates() Optional. A list of update types the bot is subscribed to. Defaults to all update types
+ */
+class WebhookInfo extends Entity
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Exception/TelegramException.php b/vendor/longman/telegram-bot/src/Exception/TelegramException.php
new file mode 100644
index 0000000..e8336a4
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Exception/TelegramException.php
@@ -0,0 +1,19 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Exception;
+
+/**
+ * Main exception class used for exception handling
+ */
+class TelegramException extends \Exception
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Exception/TelegramLogException.php b/vendor/longman/telegram-bot/src/Exception/TelegramLogException.php
new file mode 100644
index 0000000..d288804
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Exception/TelegramLogException.php
@@ -0,0 +1,19 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Exception;
+
+/**
+ * Main exception class used for exception handling
+ */
+class TelegramLogException extends \Exception
+{
+
+}
diff --git a/vendor/longman/telegram-bot/src/Request.php b/vendor/longman/telegram-bot/src/Request.php
new file mode 100644
index 0000000..a6ba4a5
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Request.php
@@ -0,0 +1,703 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot;
+
+use GuzzleHttp\Client;
+use GuzzleHttp\Exception\RequestException;
+use Longman\TelegramBot\Entities\File;
+use Longman\TelegramBot\Entities\ServerResponse;
+use Longman\TelegramBot\Exception\TelegramException;
+
+/**
+ * Class Request
+ *
+ * @method static ServerResponse getUpdates(array $data) Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
+ * @method static ServerResponse setWebhook(array $data) Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns true.
+ * @method static ServerResponse deleteWebhook() Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters.
+ * @method static ServerResponse getWebhookInfo() Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty.
+ * @method static ServerResponse getMe() A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a User object.
+ * @method static ServerResponse forwardMessage(array $data) Use this method to forward messages of any kind. On success, the sent Message is returned.
+ * @method static ServerResponse sendPhoto(array $data) Use this method to send photos. On success, the sent Message is returned.
+ * @method static ServerResponse sendAudio(array $data) Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
+ * @method static ServerResponse sendDocument(array $data) Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
+ * @method static ServerResponse sendSticker(array $data) Use this method to send .webp stickers. On success, the sent Message is returned.
+ * @method static ServerResponse sendVideo(array $data) Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
+ * @method static ServerResponse sendVoice(array $data) Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
+ * @method static ServerResponse sendVideoNote(array $data) Use this method to send video messages. On success, the sent Message is returned.
+ * @method static ServerResponse sendMediaGroup(array $data) Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned.
+ * @method static ServerResponse sendLocation(array $data) Use this method to send point on the map. On success, the sent Message is returned.
+ * @method static ServerResponse editMessageLiveLocation(array $data) Use this method to edit live location messages sent by the bot or via the bot (for inline bots). A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise True is returned.
+ * @method static ServerResponse stopMessageLiveLocation(array $data) Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires. On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned.
+ * @method static ServerResponse sendVenue(array $data) Use this method to send information about a venue. On success, the sent Message is returned.
+ * @method static ServerResponse sendContact(array $data) Use this method to send phone contacts. On success, the sent Message is returned.
+ * @method static ServerResponse sendChatAction(array $data) Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
+ * @method static ServerResponse getUserProfilePhotos(array $data) Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
+ * @method static ServerResponse getFile(array $data) Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot/, where is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
+ * @method static ServerResponse kickChatMember(array $data) Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
+ * @method static ServerResponse unbanChatMember(array $data) Use this method to unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success.
+ * @method static ServerResponse restrictChatMember(array $data) Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a user. Returns True on success.
+ * @method static ServerResponse promoteChatMember(array $data) Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success.
+ * @method static ServerResponse exportChatInviteLink(array $data) Use this method to export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns exported invite link as String on success.
+ * @method static ServerResponse setChatPhoto(array $data) Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
+ * @method static ServerResponse deleteChatPhoto(array $data) Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
+ * @method static ServerResponse setChatTitle(array $data) Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
+ * @method static ServerResponse setChatDescription(array $data) Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success.
+ * @method static ServerResponse pinChatMessage(array $data) Use this method to pin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success.
+ * @method static ServerResponse unpinChatMessage(array $data) Use this method to unpin a message in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel. Returns True on success.
+ * @method static ServerResponse leaveChat(array $data) Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
+ * @method static ServerResponse getChat(array $data) Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success.
+ * @method static ServerResponse getChatAdministrators(array $data) Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
+ * @method static ServerResponse getChatMembersCount(array $data) Use this method to get the number of members in a chat. Returns Int on success.
+ * @method static ServerResponse getChatMember(array $data) Use this method to get information about a member of a chat. Returns a ChatMember object on success.
+ * @method static ServerResponse setChatStickerSet(array $data) Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
+ * @method static ServerResponse deleteChatStickerSet(array $data) Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
+ * @method static ServerResponse answerCallbackQuery(array $data) Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
+ * @method static ServerResponse answerInlineQuery(array $data) Use this method to send answers to an inline query. On success, True is returned.
+ * @method static ServerResponse editMessageText(array $data) Use this method to edit text and game messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
+ * @method static ServerResponse editMessageCaption(array $data) Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
+ * @method static ServerResponse editMessageReplyMarkup(array $data) Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
+ * @method static ServerResponse deleteMessage(array $data) Use this method to delete a message, including service messages, with certain limitations. Returns True on success.
+ * @method static ServerResponse getStickerSet(array $data) Use this method to get a sticker set. On success, a StickerSet object is returned.
+ * @method static ServerResponse uploadStickerFile(array $data) Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success.
+ * @method static ServerResponse createNewStickerSet(array $data) Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success.
+ * @method static ServerResponse addStickerToSet(array $data) Use this method to add a new sticker to a set created by the bot. Returns True on success.
+ * @method static ServerResponse setStickerPositionInSet(array $data) Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.
+ * @method static ServerResponse deleteStickerFromSet(array $data) Use this method to delete a sticker from a set created by the bot. Returns True on success.
+ * @method static ServerResponse sendInvoice(array $data) Use this method to send invoices. On success, the sent Message is returned.
+ * @method static ServerResponse answerShippingQuery(array $data) If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.
+ * @method static ServerResponse answerPreCheckoutQuery(array $data) Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned.
+ */
+class Request
+{
+ /**
+ * Telegram object
+ *
+ * @var \Longman\TelegramBot\Telegram
+ */
+ private static $telegram;
+
+ /**
+ * URI of the Telegram API
+ *
+ * @var string
+ */
+ private static $api_base_uri = 'https://api.telegram.org';
+
+ /**
+ * Guzzle Client object
+ *
+ * @var \GuzzleHttp\Client
+ */
+ private static $client;
+
+ /**
+ * Input value of the request
+ *
+ * @var string
+ */
+ private static $input;
+
+ /**
+ * Request limiter
+ *
+ * @var boolean
+ */
+ private static $limiter_enabled;
+
+ /**
+ * Request limiter's interval between checks
+ *
+ * @var float
+ */
+ private static $limiter_interval;
+
+ /**
+ * Available actions to send
+ *
+ * This is basically the list of all methods listed on the official API documentation.
+ *
+ * @link https://core.telegram.org/bots/api
+ *
+ * @var array
+ */
+ private static $actions = [
+ 'getUpdates',
+ 'setWebhook',
+ 'deleteWebhook',
+ 'getWebhookInfo',
+ 'getMe',
+ 'sendMessage',
+ 'forwardMessage',
+ 'sendPhoto',
+ 'sendAudio',
+ 'sendDocument',
+ 'sendSticker',
+ 'sendVideo',
+ 'sendVoice',
+ 'sendVideoNote',
+ 'sendMediaGroup',
+ 'sendLocation',
+ 'editMessageLiveLocation',
+ 'stopMessageLiveLocation',
+ 'sendVenue',
+ 'sendContact',
+ 'sendChatAction',
+ 'getUserProfilePhotos',
+ 'getFile',
+ 'kickChatMember',
+ 'unbanChatMember',
+ 'restrictChatMember',
+ 'promoteChatMember',
+ 'exportChatInviteLink',
+ 'setChatPhoto',
+ 'deleteChatPhoto',
+ 'setChatTitle',
+ 'setChatDescription',
+ 'pinChatMessage',
+ 'unpinChatMessage',
+ 'leaveChat',
+ 'getChat',
+ 'getChatAdministrators',
+ 'getChatMembersCount',
+ 'getChatMember',
+ 'setChatStickerSet',
+ 'deleteChatStickerSet',
+ 'answerCallbackQuery',
+ 'answerInlineQuery',
+ 'editMessageText',
+ 'editMessageCaption',
+ 'editMessageReplyMarkup',
+ 'deleteMessage',
+ 'getStickerSet',
+ 'uploadStickerFile',
+ 'createNewStickerSet',
+ 'addStickerToSet',
+ 'setStickerPositionInSet',
+ 'deleteStickerFromSet',
+ 'sendInvoice',
+ 'answerShippingQuery',
+ 'answerPreCheckoutQuery',
+ ];
+
+ /**
+ * Some methods need a dummy param due to certain cURL issues.
+ *
+ * @see Request::addDummyParamIfNecessary()
+ *
+ * @var array
+ */
+ private static $actions_need_dummy_param = [
+ 'deleteWebhook',
+ 'getWebhookInfo',
+ 'getMe',
+ ];
+
+ /**
+ * Initialize
+ *
+ * @param \Longman\TelegramBot\Telegram $telegram
+ *
+ * @throws TelegramException
+ */
+ public static function initialize(Telegram $telegram)
+ {
+ if (!($telegram instanceof Telegram)) {
+ throw new TelegramException('Invalid Telegram pointer!');
+ }
+
+ self::$telegram = $telegram;
+ self::setClient(new Client(['base_uri' => self::$api_base_uri]));
+ }
+
+ /**
+ * Set a custom Guzzle HTTP Client object
+ *
+ * @param Client $client
+ *
+ * @throws TelegramException
+ */
+ public static function setClient(Client $client)
+ {
+ if (!($client instanceof Client)) {
+ throw new TelegramException('Invalid GuzzleHttp\Client pointer!');
+ }
+
+ self::$client = $client;
+ }
+
+ /**
+ * Set input from custom input or stdin and return it
+ *
+ * @return string
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public static function getInput()
+ {
+ // First check if a custom input has been set, else get the PHP input.
+ if (!($input = self::$telegram->getCustomInput())) {
+ $input = file_get_contents('php://input');
+ }
+
+ // Make sure we have a string to work with.
+ if (!is_string($input)) {
+ throw new TelegramException('Input must be a string!');
+ }
+
+ self::$input = $input;
+
+ TelegramLog::update(self::$input);
+
+ return self::$input;
+ }
+
+ /**
+ * Generate general fake server response
+ *
+ * @param array $data Data to add to fake response
+ *
+ * @return array Fake response data
+ */
+ public static function generateGeneralFakeServerResponse(array $data = [])
+ {
+ //PARAM BINDED IN PHPUNIT TEST FOR TestServerResponse.php
+ //Maybe this is not the best possible implementation
+
+ //No value set in $data ie testing setWebhook
+ //Provided $data['chat_id'] ie testing sendMessage
+
+ $fake_response = ['ok' => true]; // :)
+
+ if ($data === []) {
+ $fake_response['result'] = true;
+ }
+
+ //some data to let iniatilize the class method SendMessage
+ if (isset($data['chat_id'])) {
+ $data['message_id'] = '1234';
+ $data['date'] = '1441378360';
+ $data['from'] = [
+ 'id' => 123456789,
+ 'first_name' => 'botname',
+ 'username' => 'namebot',
+ ];
+ $data['chat'] = ['id' => $data['chat_id']];
+
+ $fake_response['result'] = $data;
+ }
+
+ return $fake_response;
+ }
+
+ /**
+ * Properly set up the request params
+ *
+ * If any item of the array is a resource, reformat it to a multipart request.
+ * Else, just return the passed data as form params.
+ *
+ * @param array $data
+ *
+ * @return array
+ */
+ private static function setUpRequestParams(array $data)
+ {
+ $has_resource = false;
+ $multipart = [];
+
+ // Convert any nested arrays into JSON strings.
+ array_walk($data, function (&$item) {
+ is_array($item) && $item = json_encode($item);
+ });
+
+ //Reformat data array in multipart way if it contains a resource
+ foreach ($data as $key => $item) {
+ $has_resource |= (is_resource($item) || $item instanceof \GuzzleHttp\Psr7\Stream);
+ $multipart[] = ['name' => $key, 'contents' => $item];
+ }
+ if ($has_resource) {
+ return ['multipart' => $multipart];
+ }
+
+ return ['form_params' => $data];
+ }
+
+ /**
+ * Execute HTTP Request
+ *
+ * @param string $action Action to execute
+ * @param array $data Data to attach to the execution
+ *
+ * @return string Result of the HTTP Request
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public static function execute($action, array $data = [])
+ {
+ //Fix so that the keyboard markup is a string, not an object
+ if (isset($data['reply_markup'])) {
+ $data['reply_markup'] = json_encode($data['reply_markup']);
+ }
+
+ $result = null;
+ $request_params = self::setUpRequestParams($data);
+ $request_params['debug'] = TelegramLog::getDebugLogTempStream();
+
+ try {
+ $response = self::$client->post(
+ '/bot' . self::$telegram->getApiKey() . '/' . $action,
+ $request_params
+ );
+ $result = (string) $response->getBody();
+
+ //Logging getUpdates Update
+ if ($action === 'getUpdates') {
+ TelegramLog::update($result);
+ }
+ } catch (RequestException $e) {
+ $result = ($e->getResponse()) ? (string) $e->getResponse()->getBody() : '';
+ } finally {
+ //Logging verbose debug output
+ TelegramLog::endDebugLogTempStream('Verbose HTTP Request output:' . PHP_EOL . '%s' . PHP_EOL);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Download file
+ *
+ * @param \Longman\TelegramBot\Entities\File $file
+ *
+ * @return boolean
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public static function downloadFile(File $file)
+ {
+ if (empty($download_path = self::$telegram->getDownloadPath())) {
+ throw new TelegramException('Download path not set!');
+ }
+
+ $tg_file_path = $file->getFilePath();
+ $file_path = $download_path . '/' . $tg_file_path;
+
+ $file_dir = dirname($file_path);
+ //For safety reasons, first try to create the directory, then check that it exists.
+ //This is in case some other process has created the folder in the meantime.
+ if (!@mkdir($file_dir, 0755, true) && !is_dir($file_dir)) {
+ throw new TelegramException('Directory ' . $file_dir . ' can\'t be created');
+ }
+
+ $debug_handle = TelegramLog::getDebugLogTempStream();
+
+ try {
+ self::$client->get(
+ '/file/bot' . self::$telegram->getApiKey() . '/' . $tg_file_path,
+ ['debug' => $debug_handle, 'sink' => $file_path]
+ );
+
+ return filesize($file_path) > 0;
+ } catch (RequestException $e) {
+ return ($e->getResponse()) ? (string) $e->getResponse()->getBody() : '';
+ } finally {
+ //Logging verbose debug output
+ TelegramLog::endDebugLogTempStream('Verbose HTTP File Download Request output:' . PHP_EOL . '%s' . PHP_EOL);
+ }
+ }
+
+ /**
+ * Encode file
+ *
+ * @param string $file
+ *
+ * @return resource
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public static function encodeFile($file)
+ {
+ $fp = fopen($file, 'rb');
+ if ($fp === false) {
+ throw new TelegramException('Cannot open "' . $file . '" for reading');
+ }
+
+ return $fp;
+ }
+
+ /**
+ * Send command
+ *
+ * @todo Fake response doesn't need json encoding?
+ * @todo Write debug entry on failure
+ *
+ * @param string $action
+ * @param array $data
+ *
+ * @return \Longman\TelegramBot\Entities\ServerResponse
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public static function send($action, array $data = [])
+ {
+ self::ensureValidAction($action);
+ self::addDummyParamIfNecessary($action, $data);
+
+ $bot_username = self::$telegram->getBotUsername();
+
+ if (defined('PHPUNIT_TESTSUITE')) {
+ $fake_response = self::generateGeneralFakeServerResponse($data);
+
+ return new ServerResponse($fake_response, $bot_username);
+ }
+
+ self::ensureNonEmptyData($data);
+
+ self::limitTelegramRequests($action, $data);
+
+ $response = json_decode(self::execute($action, $data), true);
+
+ if (null === $response) {
+ throw new TelegramException('Telegram returned an invalid response! Please review your bot name and API key.');
+ }
+
+ return new ServerResponse($response, $bot_username);
+ }
+
+ /**
+ * Add a dummy parameter if the passed action requires it.
+ *
+ * If a method doesn't require parameters, we need to add a dummy one anyway,
+ * because of some cURL version failed POST request without parameters.
+ *
+ * @link https://github.com/php-telegram-bot/core/pull/228
+ *
+ * @todo Would be nice to find a better solution for this!
+ *
+ * @param string $action
+ * @param array $data
+ */
+ protected static function addDummyParamIfNecessary($action, array &$data)
+ {
+ if (in_array($action, self::$actions_need_dummy_param, true)) {
+ // Can be anything, using a single letter to minimise request size.
+ $data = ['d'];
+ }
+ }
+
+ /**
+ * Make sure the data isn't empty, else throw an exception
+ *
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ private static function ensureNonEmptyData(array $data)
+ {
+ if (count($data) === 0) {
+ throw new TelegramException('Data is empty!');
+ }
+ }
+
+ /**
+ * Make sure the action is valid, else throw an exception
+ *
+ * @param string $action
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ private static function ensureValidAction($action)
+ {
+ if (!in_array($action, self::$actions, true)) {
+ throw new TelegramException('The action "' . $action . '" doesn\'t exist!');
+ }
+ }
+
+ /**
+ * Use this method to send text messages. On success, the sent Message is returned
+ *
+ * @link https://core.telegram.org/bots/api#sendmessage
+ *
+ * @param array $data
+ *
+ * @return \Longman\TelegramBot\Entities\ServerResponse
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public static function sendMessage(array $data)
+ {
+ $text = $data['text'];
+
+ do {
+ //Chop off and send the first message
+ $data['text'] = mb_substr($text, 0, 4096);
+ $response = self::send('sendMessage', $data);
+
+ //Prepare the next message
+ $text = mb_substr($text, 4096);
+ } while (mb_strlen($text, 'UTF-8') > 0);
+
+ return $response;
+ }
+
+ /**
+ * Any statically called method should be relayed to the `send` method.
+ *
+ * @param string $action
+ * @param array $data
+ *
+ * @return \Longman\TelegramBot\Entities\ServerResponse
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public static function __callStatic($action, array $data)
+ {
+ // Make sure to add the action being called as the first parameter to be passed.
+ array_unshift($data, $action);
+
+ // @todo Use splat operator for unpacking when we move to PHP 5.6+
+ return call_user_func_array('static::send', $data);
+ }
+
+ /**
+ * Return an empty Server Response
+ *
+ * No request to telegram are sent, this function is used in commands that
+ * don't need to fire a message after execution
+ *
+ * @return \Longman\TelegramBot\Entities\ServerResponse
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public static function emptyResponse()
+ {
+ return new ServerResponse(['ok' => true, 'result' => true], null);
+ }
+
+ /**
+ * Send message to all active chats
+ *
+ * @param string $callback_function
+ * @param array $data
+ * @param array $select_chats_params
+ *
+ * @return array
+ * @throws TelegramException
+ */
+ public static function sendToActiveChats(
+ $callback_function,
+ array $data,
+ array $select_chats_params
+ ) {
+ if (!method_exists(Request::class, $callback_function)) {
+ throw new TelegramException('Method "' . $callback_function . '" not found in class Request.');
+ }
+
+ $chats = DB::selectChats($select_chats_params);
+
+ $results = [];
+ if (is_array($chats)) {
+ foreach ($chats as $row) {
+ $data['chat_id'] = $row['chat_id'];
+ $results[] = call_user_func(Request::class . '::' . $callback_function, $data);
+ }
+ }
+
+ return $results;
+ }
+
+ /**
+ * Enable request limiter
+ *
+ * @param boolean $enable
+ * @param array $options
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public static function setLimiter($enable = true, array $options = [])
+ {
+ if (DB::isDbConnected()) {
+ $options_default = [
+ 'interval' => 1,
+ ];
+
+ $options = array_merge($options_default, $options);
+
+ if (!is_numeric($options['interval']) || $options['interval'] <= 0) {
+ throw new TelegramException('Interval must be a number and must be greater than zero!');
+ }
+
+ self::$limiter_interval = $options['interval'];
+ self::$limiter_enabled = $enable;
+ }
+ }
+
+ /**
+ * This functions delays API requests to prevent reaching Telegram API limits
+ * Can be disabled while in execution by 'Request::setLimiter(false)'
+ *
+ * @link https://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-this
+ *
+ * @param string $action
+ * @param array $data
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ private static function limitTelegramRequests($action, array $data = [])
+ {
+ if (self::$limiter_enabled) {
+ $limited_methods = [
+ 'sendMessage',
+ 'forwardMessage',
+ 'sendPhoto',
+ 'sendAudio',
+ 'sendDocument',
+ 'sendSticker',
+ 'sendVideo',
+ 'sendVoice',
+ 'sendVideoNote',
+ 'sendMediaGroup',
+ 'sendLocation',
+ 'editMessageLiveLocation',
+ 'stopMessageLiveLocation',
+ 'sendVenue',
+ 'sendContact',
+ 'sendInvoice',
+ 'editMessageText',
+ 'editMessageCaption',
+ 'editMessageReplyMarkup',
+ 'setChatTitle',
+ 'setChatDescription',
+ 'setChatStickerSet',
+ 'deleteChatStickerSet',
+ ];
+
+ $chat_id = isset($data['chat_id']) ? $data['chat_id'] : null;
+ $inline_message_id = isset($data['inline_message_id']) ? $data['inline_message_id'] : null;
+
+ if (($chat_id || $inline_message_id) && in_array($action, $limited_methods)) {
+ $timeout = 60;
+
+ while (true) {
+ if ($timeout <= 0) {
+ throw new TelegramException('Timed out while waiting for a request spot!');
+ }
+
+ $requests = DB::getTelegramRequestCount($chat_id, $inline_message_id);
+
+ $chat_per_second = ($requests['LIMIT_PER_SEC'] == 0); // No more than one message per second inside a particular chat
+ $global_per_second = ($requests['LIMIT_PER_SEC_ALL'] < 30); // No more than 30 messages per second to different chats
+ $groups_per_minute = (((is_numeric($chat_id) && $chat_id > 0) || !is_null($inline_message_id)) || ((!is_numeric($chat_id) || $chat_id < 0) && $requests['LIMIT_PER_MINUTE'] < 20)); // No more than 20 messages per minute in groups and channels
+
+ if ($chat_per_second && $global_per_second && $groups_per_minute) {
+ break;
+ }
+
+ $timeout--;
+ usleep(self::$limiter_interval * 1000000);
+ }
+
+ DB::insertTelegramRequest($action, $data);
+ }
+ }
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/Telegram.php b/vendor/longman/telegram-bot/src/Telegram.php
new file mode 100644
index 0000000..8ed61a5
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/Telegram.php
@@ -0,0 +1,962 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot;
+
+define('BASE_PATH', __DIR__);
+define('BASE_COMMANDS_PATH', BASE_PATH . '/Commands');
+
+use Exception;
+use Longman\TelegramBot\Commands\Command;
+use Longman\TelegramBot\Entities\ServerResponse;
+use Longman\TelegramBot\Entities\Update;
+use Longman\TelegramBot\Exception\TelegramException;
+use PDO;
+use RecursiveDirectoryIterator;
+use RecursiveIteratorIterator;
+use RegexIterator;
+
+class Telegram
+{
+ /**
+ * Version
+ *
+ * @var string
+ */
+ protected $version = '0.51.0';
+
+ /**
+ * Telegram API key
+ *
+ * @var string
+ */
+ protected $api_key = '';
+
+ /**
+ * Telegram Bot username
+ *
+ * @var string
+ */
+ protected $bot_username = '';
+
+ /**
+ * Telegram Bot id
+ *
+ * @var string
+ */
+ protected $bot_id = '';
+
+ /**
+ * Raw request data (json) for webhook methods
+ *
+ * @var string
+ */
+ protected $input;
+
+ /**
+ * Custom commands paths
+ *
+ * @var array
+ */
+ protected $commands_paths = [];
+
+ /**
+ * Current Update object
+ *
+ * @var \Longman\TelegramBot\Entities\Update
+ */
+ protected $update;
+
+ /**
+ * Upload path
+ *
+ * @var string
+ */
+ protected $upload_path;
+
+ /**
+ * Download path
+ *
+ * @var string
+ */
+ protected $download_path;
+
+ /**
+ * MySQL integration
+ *
+ * @var boolean
+ */
+ protected $mysql_enabled = false;
+
+ /**
+ * PDO object
+ *
+ * @var \PDO
+ */
+ protected $pdo;
+
+ /**
+ * Commands config
+ *
+ * @var array
+ */
+ protected $commands_config = [];
+
+ /**
+ * Admins list
+ *
+ * @var array
+ */
+ protected $admins_list = [];
+
+ /**
+ * ServerResponse of the last Command execution
+ *
+ * @var \Longman\TelegramBot\Entities\ServerResponse
+ */
+ protected $last_command_response;
+
+ /**
+ * Botan.io integration
+ *
+ * @var boolean
+ */
+ protected $botan_enabled = false;
+
+ /**
+ * Check if runCommands() is running in this session
+ *
+ * @var boolean
+ */
+ protected $run_commands = false;
+
+ /**
+ * Telegram constructor.
+ *
+ * @param string $api_key
+ * @param string $bot_username
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function __construct($api_key, $bot_username = '')
+ {
+ if (empty($api_key)) {
+ throw new TelegramException('API KEY not defined!');
+ }
+ preg_match('/(\d+)\:[\w\-]+/', $api_key, $matches);
+ if (!isset($matches[1])) {
+ throw new TelegramException('Invalid API KEY defined!');
+ }
+ $this->bot_id = $matches[1];
+ $this->api_key = $api_key;
+
+ if (!empty($bot_username)) {
+ $this->bot_username = $bot_username;
+ }
+
+ //Add default system commands path
+ $this->addCommandsPath(BASE_COMMANDS_PATH . '/SystemCommands');
+
+ Request::initialize($this);
+ }
+
+ /**
+ * Initialize Database connection
+ *
+ * @param array $credential
+ * @param string $table_prefix
+ * @param string $encoding
+ *
+ * @return \Longman\TelegramBot\Telegram
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function enableMySql(array $credential, $table_prefix = null, $encoding = 'utf8mb4')
+ {
+ $this->pdo = DB::initialize($credential, $this, $table_prefix, $encoding);
+ ConversationDB::initializeConversation();
+ $this->mysql_enabled = true;
+
+ return $this;
+ }
+
+ /**
+ * Initialize Database external connection
+ *
+ * @param PDO $external_pdo_connection PDO database object
+ * @param string $table_prefix
+ *
+ * @return \Longman\TelegramBot\Telegram
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function enableExternalMySql($external_pdo_connection, $table_prefix = null)
+ {
+ $this->pdo = DB::externalInitialize($external_pdo_connection, $this, $table_prefix);
+ ConversationDB::initializeConversation();
+ $this->mysql_enabled = true;
+
+ return $this;
+ }
+
+ /**
+ * Get commands list
+ *
+ * @return array $commands
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function getCommandsList()
+ {
+ $commands = [];
+
+ foreach ($this->commands_paths as $path) {
+ try {
+ //Get all "*Command.php" files
+ $files = new RegexIterator(
+ new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator($path)
+ ),
+ '/^.+Command.php$/'
+ );
+
+ foreach ($files as $file) {
+ //Remove "Command.php" from filename
+ $command = $this->sanitizeCommand(substr($file->getFilename(), 0, -11));
+ $command_name = strtolower($command);
+
+ if (array_key_exists($command_name, $commands)) {
+ continue;
+ }
+
+ require_once $file->getPathname();
+
+ $command_obj = $this->getCommandObject($command);
+ if ($command_obj instanceof Command) {
+ $commands[$command_name] = $command_obj;
+ }
+ }
+ } catch (Exception $e) {
+ throw new TelegramException('Error getting commands from path: ' . $path);
+ }
+ }
+
+ return $commands;
+ }
+
+ /**
+ * Get an object instance of the passed command
+ *
+ * @param string $command
+ *
+ * @return \Longman\TelegramBot\Commands\Command|null
+ */
+ public function getCommandObject($command)
+ {
+ $which = ['System'];
+ $this->isAdmin() && $which[] = 'Admin';
+ $which[] = 'User';
+
+ foreach ($which as $auth) {
+ $command_namespace = __NAMESPACE__ . '\\Commands\\' . $auth . 'Commands\\' . $this->ucfirstUnicode($command) . 'Command';
+ if (class_exists($command_namespace)) {
+ return new $command_namespace($this, $this->update);
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Set custom input string for debug purposes
+ *
+ * @param string $input (json format)
+ *
+ * @return \Longman\TelegramBot\Telegram
+ */
+ public function setCustomInput($input)
+ {
+ $this->input = $input;
+
+ return $this;
+ }
+
+ /**
+ * Get custom input string for debug purposes
+ *
+ * @return string
+ */
+ public function getCustomInput()
+ {
+ return $this->input;
+ }
+
+ /**
+ * Get the ServerResponse of the last Command execution
+ *
+ * @return \Longman\TelegramBot\Entities\ServerResponse
+ */
+ public function getLastCommandResponse()
+ {
+ return $this->last_command_response;
+ }
+
+ /**
+ * Handle getUpdates method
+ *
+ * @param int|null $limit
+ * @param int|null $timeout
+ *
+ * @return \Longman\TelegramBot\Entities\ServerResponse
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function handleGetUpdates($limit = null, $timeout = null)
+ {
+ if (empty($this->bot_username)) {
+ throw new TelegramException('Bot Username is not defined!');
+ }
+
+ if (!DB::isDbConnected()) {
+ return new ServerResponse(
+ [
+ 'ok' => false,
+ 'description' => 'getUpdates needs MySQL connection!',
+ ],
+ $this->bot_username
+ );
+ }
+
+ //Take custom input into account.
+ if ($custom_input = $this->getCustomInput()) {
+ $response = new ServerResponse(json_decode($custom_input, true), $this->bot_username);
+ } else {
+ //DB Query
+ $last_update = DB::selectTelegramUpdate(1);
+ $last_update = reset($last_update);
+
+ //As explained in the telegram bot api documentation
+ $offset = isset($last_update['id']) ? $last_update['id'] + 1 : null;
+
+ $response = Request::getUpdates(
+ [
+ 'offset' => $offset,
+ 'limit' => $limit,
+ 'timeout' => $timeout,
+ ]
+ );
+ }
+
+ if ($response->isOk()) {
+ //Process all updates
+ /** @var Update $result */
+ foreach ((array) $response->getResult() as $result) {
+ $this->processUpdate($result);
+ }
+ }
+
+ return $response;
+ }
+
+ /**
+ * Handle bot request from webhook
+ *
+ * @return bool
+ *
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function handle()
+ {
+ if (empty($this->bot_username)) {
+ throw new TelegramException('Bot Username is not defined!');
+ }
+
+ $this->input = Request::getInput();
+
+ if (empty($this->input)) {
+ throw new TelegramException('Input is empty!');
+ }
+
+ $post = json_decode($this->input, true);
+ if (empty($post)) {
+ throw new TelegramException('Invalid JSON!');
+ }
+
+ if ($response = $this->processUpdate(new Update($post, $this->bot_username))) {
+ return $response->isOk();
+ }
+
+ return false;
+ }
+
+ /**
+ * Get the command name from the command type
+ *
+ * @param string $type
+ *
+ * @return string
+ */
+ protected function getCommandFromType($type)
+ {
+ return $this->ucfirstUnicode(str_replace('_', '', $type));
+ }
+
+ /**
+ * Process bot Update request
+ *
+ * @param \Longman\TelegramBot\Entities\Update $update
+ *
+ * @return \Longman\TelegramBot\Entities\ServerResponse
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function processUpdate(Update $update)
+ {
+ $this->update = $update;
+
+ //If all else fails, it's a generic message.
+ $command = 'genericmessage';
+
+ $update_type = $this->update->getUpdateType();
+ if ($update_type === 'message') {
+ $message = $this->update->getMessage();
+
+ //Load admin commands
+ if ($this->isAdmin()) {
+ $this->addCommandsPath(BASE_COMMANDS_PATH . '/AdminCommands', false);
+ }
+
+ $type = $message->getType();
+ if ($type === 'command') {
+ $command = $message->getCommand();
+ } elseif (in_array($type, [
+ 'new_chat_members',
+ 'left_chat_member',
+ 'new_chat_title',
+ 'new_chat_photo',
+ 'delete_chat_photo',
+ 'group_chat_created',
+ 'supergroup_chat_created',
+ 'channel_chat_created',
+ 'migrate_to_chat_id',
+ 'migrate_from_chat_id',
+ 'pinned_message',
+ 'invoice',
+ 'successful_payment',
+ ], true)
+ ) {
+ $command = $this->getCommandFromType($type);
+ }
+ } else {
+ $command = $this->getCommandFromType($update_type);
+ }
+
+ //Make sure we have an up-to-date command list
+ //This is necessary to "require" all the necessary command files!
+ $this->getCommandsList();
+
+ DB::insertRequest($this->update);
+
+ return $this->executeCommand($command);
+ }
+
+ /**
+ * Execute /command
+ *
+ * @param string $command
+ *
+ * @return mixed
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function executeCommand($command)
+ {
+ $command = strtolower($command);
+ $command_obj = $this->getCommandObject($command);
+
+ if (!$command_obj || !$command_obj->isEnabled()) {
+ //Failsafe in case the Generic command can't be found
+ if ($command === 'generic') {
+ throw new TelegramException('Generic command missing!');
+ }
+
+ //Handle a generic command or non existing one
+ $this->last_command_response = $this->executeCommand('generic');
+ } else {
+ //Botan.io integration, make sure only the actual command user executed is reported
+ if ($this->botan_enabled) {
+ Botan::lock($command);
+ }
+
+ //execute() method is executed after preExecute()
+ //This is to prevent executing a DB query without a valid connection
+ $this->last_command_response = $command_obj->preExecute();
+
+ //Botan.io integration, send report after executing the command
+ if ($this->botan_enabled) {
+ Botan::track($this->update, $command);
+ }
+ }
+
+ return $this->last_command_response;
+ }
+
+ /**
+ * Sanitize Command
+ *
+ * @param string $command
+ *
+ * @return string
+ */
+ protected function sanitizeCommand($command)
+ {
+ return str_replace(' ', '', $this->ucwordsUnicode(str_replace('_', ' ', $command)));
+ }
+
+ /**
+ * Enable a single Admin account
+ *
+ * @param integer $admin_id Single admin id
+ *
+ * @return \Longman\TelegramBot\Telegram
+ */
+ public function enableAdmin($admin_id)
+ {
+ if (!is_int($admin_id) || $admin_id <= 0) {
+ TelegramLog::error('Invalid value "%s" for admin.', $admin_id);
+ } elseif (!in_array($admin_id, $this->admins_list, true)) {
+ $this->admins_list[] = $admin_id;
+ }
+
+ return $this;
+ }
+
+ /**
+ * Enable a list of Admin Accounts
+ *
+ * @param array $admin_ids List of admin ids
+ *
+ * @return \Longman\TelegramBot\Telegram
+ */
+ public function enableAdmins(array $admin_ids)
+ {
+ foreach ($admin_ids as $admin_id) {
+ $this->enableAdmin($admin_id);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get list of admins
+ *
+ * @return array
+ */
+ public function getAdminList()
+ {
+ return $this->admins_list;
+ }
+
+ /**
+ * Check if the passed user is an admin
+ *
+ * If no user id is passed, the current update is checked for a valid message sender.
+ *
+ * @param int|null $user_id
+ *
+ * @return bool
+ */
+ public function isAdmin($user_id = null)
+ {
+ if ($user_id === null && $this->update !== null) {
+ //Try to figure out if the user is an admin
+ $update_methods = [
+ 'getMessage',
+ 'getEditedMessage',
+ 'getChannelPost',
+ 'getEditedChannelPost',
+ 'getInlineQuery',
+ 'getChosenInlineResult',
+ 'getCallbackQuery',
+ ];
+ foreach ($update_methods as $update_method) {
+ $object = call_user_func([$this->update, $update_method]);
+ if ($object !== null && $from = $object->getFrom()) {
+ $user_id = $from->getId();
+ break;
+ }
+ }
+ }
+
+ return ($user_id === null) ? false : in_array($user_id, $this->admins_list, true);
+ }
+
+ /**
+ * Check if user required the db connection
+ *
+ * @return bool
+ */
+ public function isDbEnabled()
+ {
+ if ($this->mysql_enabled) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Add a single custom commands path
+ *
+ * @param string $path Custom commands path to add
+ * @param bool $before If the path should be prepended or appended to the list
+ *
+ * @return \Longman\TelegramBot\Telegram
+ */
+ public function addCommandsPath($path, $before = true)
+ {
+ if (!is_dir($path)) {
+ TelegramLog::error('Commands path "%s" does not exist.', $path);
+ } elseif (!in_array($path, $this->commands_paths, true)) {
+ if ($before) {
+ array_unshift($this->commands_paths, $path);
+ } else {
+ $this->commands_paths[] = $path;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Add multiple custom commands paths
+ *
+ * @param array $paths Custom commands paths to add
+ * @param bool $before If the paths should be prepended or appended to the list
+ *
+ * @return \Longman\TelegramBot\Telegram
+ */
+ public function addCommandsPaths(array $paths, $before = true)
+ {
+ foreach ($paths as $path) {
+ $this->addCommandsPath($path, $before);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Return the list of commands paths
+ *
+ * @return array
+ */
+ public function getCommandsPaths()
+ {
+ return $this->commands_paths;
+ }
+
+ /**
+ * Set custom upload path
+ *
+ * @param string $path Custom upload path
+ *
+ * @return \Longman\TelegramBot\Telegram
+ */
+ public function setUploadPath($path)
+ {
+ $this->upload_path = $path;
+
+ return $this;
+ }
+
+ /**
+ * Get custom upload path
+ *
+ * @return string
+ */
+ public function getUploadPath()
+ {
+ return $this->upload_path;
+ }
+
+ /**
+ * Set custom download path
+ *
+ * @param string $path Custom download path
+ *
+ * @return \Longman\TelegramBot\Telegram
+ */
+ public function setDownloadPath($path)
+ {
+ $this->download_path = $path;
+
+ return $this;
+ }
+
+ /**
+ * Get custom download path
+ *
+ * @return string
+ */
+ public function getDownloadPath()
+ {
+ return $this->download_path;
+ }
+
+ /**
+ * Set command config
+ *
+ * Provide further variables to a particular commands.
+ * For example you can add the channel name at the command /sendtochannel
+ * Or you can add the api key for external service.
+ *
+ * @param string $command
+ * @param array $config
+ *
+ * @return \Longman\TelegramBot\Telegram
+ */
+ public function setCommandConfig($command, array $config)
+ {
+ $this->commands_config[$command] = $config;
+
+ return $this;
+ }
+
+ /**
+ * Get command config
+ *
+ * @param string $command
+ *
+ * @return array
+ */
+ public function getCommandConfig($command)
+ {
+ return isset($this->commands_config[$command]) ? $this->commands_config[$command] : [];
+ }
+
+ /**
+ * Get API key
+ *
+ * @return string
+ */
+ public function getApiKey()
+ {
+ return $this->api_key;
+ }
+
+ /**
+ * Get Bot name
+ *
+ * @return string
+ */
+ public function getBotUsername()
+ {
+ return $this->bot_username;
+ }
+
+ /**
+ * Get Bot Id
+ *
+ * @return string
+ */
+ public function getBotId()
+ {
+ return $this->bot_id;
+ }
+
+ /**
+ * Get Version
+ *
+ * @return string
+ */
+ public function getVersion()
+ {
+ return $this->version;
+ }
+
+ /**
+ * Set Webhook for bot
+ *
+ * @param string $url
+ * @param array $data Optional parameters.
+ *
+ * @return \Longman\TelegramBot\Entities\ServerResponse
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function setWebhook($url, array $data = [])
+ {
+ if (empty($url)) {
+ throw new TelegramException('Hook url is empty!');
+ }
+
+ $data = array_intersect_key($data, array_flip([
+ 'certificate',
+ 'max_connections',
+ 'allowed_updates',
+ ]));
+ $data['url'] = $url;
+
+ // If the certificate is passed as a path, encode and add the file to the data array.
+ if (!empty($data['certificate']) && is_string($data['certificate'])) {
+ $data['certificate'] = Request::encodeFile($data['certificate']);
+ }
+
+ $result = Request::setWebhook($data);
+
+ if (!$result->isOk()) {
+ throw new TelegramException(
+ 'Webhook was not set! Error: ' . $result->getErrorCode() . ' ' . $result->getDescription()
+ );
+ }
+
+ return $result;
+ }
+
+ /**
+ * Delete any assigned webhook
+ *
+ * @return mixed
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function deleteWebhook()
+ {
+ $result = Request::deleteWebhook();
+
+ if (!$result->isOk()) {
+ throw new TelegramException(
+ 'Webhook was not deleted! Error: ' . $result->getErrorCode() . ' ' . $result->getDescription()
+ );
+ }
+
+ return $result;
+ }
+
+ /**
+ * Replace function `ucwords` for UTF-8 characters in the class definition and commands
+ *
+ * @param string $str
+ * @param string $encoding (default = 'UTF-8')
+ *
+ * @return string
+ */
+ protected function ucwordsUnicode($str, $encoding = 'UTF-8')
+ {
+ return mb_convert_case($str, MB_CASE_TITLE, $encoding);
+ }
+
+ /**
+ * Replace function `ucfirst` for UTF-8 characters in the class definition and commands
+ *
+ * @param string $str
+ * @param string $encoding (default = 'UTF-8')
+ *
+ * @return string
+ */
+ protected function ucfirstUnicode($str, $encoding = 'UTF-8')
+ {
+ return
+ mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding)
+ . mb_strtolower(mb_substr($str, 1, mb_strlen($str), $encoding), $encoding);
+ }
+
+ /**
+ * Enable Botan.io integration
+ *
+ * @param string $token
+ * @param array $options
+ *
+ * @return \Longman\TelegramBot\Telegram
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function enableBotan($token, array $options = [])
+ {
+ Botan::initializeBotan($token, $options);
+ $this->botan_enabled = true;
+
+ return $this;
+ }
+
+ /**
+ * Enable requests limiter
+ *
+ * @param array $options
+ *
+ * @return \Longman\TelegramBot\Telegram
+ */
+ public function enableLimiter(array $options = [])
+ {
+ Request::setLimiter(true, $options);
+
+ return $this;
+ }
+
+ /**
+ * Run provided commands
+ *
+ * @param array $commands
+ *
+ * @throws TelegramException
+ */
+ public function runCommands($commands)
+ {
+ if (!is_array($commands) || empty($commands)) {
+ throw new TelegramException('No command(s) provided!');
+ }
+
+ $this->run_commands = true;
+ $this->botan_enabled = false; // Force disable Botan.io integration, we don't want to track self-executed commands!
+
+ $result = Request::getMe();
+
+ if ($result->isOk()) {
+ $result = $result->getResult();
+
+ $bot_id = $result->getId();
+ $bot_name = $result->getFirstName();
+ $bot_username = $result->getUsername();
+ } else {
+ $bot_id = $this->getBotId();
+ $bot_name = $this->getBotUsername();
+ $bot_username = $this->getBotUsername();
+ }
+
+
+ $this->enableAdmin($bot_id); // Give bot access to admin commands
+ $this->getCommandsList(); // Load full commands list
+
+ foreach ($commands as $command) {
+ $this->update = new Update(
+ [
+ 'update_id' => 0,
+ 'message' => [
+ 'message_id' => 0,
+ 'from' => [
+ 'id' => $bot_id,
+ 'first_name' => $bot_name,
+ 'username' => $bot_username,
+ ],
+ 'date' => time(),
+ 'chat' => [
+ 'id' => $bot_id,
+ 'type' => 'private',
+ ],
+ 'text' => $command,
+ ],
+ ]
+ );
+
+ $this->executeCommand($this->update->getMessage()->getCommand());
+ }
+ }
+
+ /**
+ * Is this session initiated by runCommands()
+ *
+ * @return bool
+ */
+ public function isRunCommands()
+ {
+ return $this->run_commands;
+ }
+}
diff --git a/vendor/longman/telegram-bot/src/TelegramLog.php b/vendor/longman/telegram-bot/src/TelegramLog.php
new file mode 100644
index 0000000..5788071
--- /dev/null
+++ b/vendor/longman/telegram-bot/src/TelegramLog.php
@@ -0,0 +1,289 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot;
+
+use Longman\TelegramBot\Exception\TelegramLogException;
+use Monolog\Formatter\LineFormatter;
+use Monolog\Handler\StreamHandler;
+use Monolog\Logger;
+
+class TelegramLog
+{
+ /**
+ * Monolog instance
+ *
+ * @var \Monolog\Logger
+ */
+ static protected $monolog;
+
+ /**
+ * Monolog instance for update
+ *
+ * @var \Monolog\Logger
+ */
+ static protected $monolog_update;
+
+ /**
+ * Path for error log
+ *
+ * @var string
+ */
+ static protected $error_log_path;
+
+ /**
+ * Path for debug log
+ *
+ * @var string
+ */
+ static protected $debug_log_path;
+
+ /**
+ * Path for update log
+ *
+ * @var string
+ */
+ static protected $update_log_path;
+
+ /**
+ * Temporary stream handle for debug log
+ *
+ * @var resource|null
+ */
+ static protected $debug_log_temp_stream_handle;
+
+ /**
+ * Initialize Monolog Logger instance, optionally passing an existing one
+ *
+ * @param \Monolog\Logger
+ *
+ * @return \Monolog\Logger
+ */
+ public static function initialize(Logger $external_monolog = null)
+ {
+ if (self::$monolog === null) {
+ if ($external_monolog !== null) {
+ self::$monolog = $external_monolog;
+
+ foreach (self::$monolog->getHandlers() as $handler) {
+ if (method_exists($handler, 'getLevel') && $handler->getLevel() === 400) {
+ self::$error_log_path = 'true';
+ }
+ if (method_exists($handler, 'getLevel') && $handler->getLevel() === 100) {
+ self::$debug_log_path = 'true';
+ }
+ }
+ } else {
+ self::$monolog = new Logger('bot_log');
+ }
+ }
+
+ return self::$monolog;
+ }
+
+ /**
+ * Initialize error log
+ *
+ * @param string $path
+ *
+ * @return \Monolog\Logger
+ * @throws \Longman\TelegramBot\Exception\TelegramLogException
+ * @throws \InvalidArgumentException
+ * @throws \Exception
+ */
+ public static function initErrorLog($path)
+ {
+ if ($path === null || $path === '') {
+ throw new TelegramLogException('Empty path for error log');
+ }
+ self::initialize();
+ self::$error_log_path = $path;
+
+ return self::$monolog->pushHandler(
+ (new StreamHandler(self::$error_log_path, Logger::ERROR))
+ ->setFormatter(new LineFormatter(null, null, true))
+ );
+ }
+
+ /**
+ * Initialize debug log
+ *
+ * @param string $path
+ *
+ * @return \Monolog\Logger
+ * @throws \Longman\TelegramBot\Exception\TelegramLogException
+ * @throws \InvalidArgumentException
+ * @throws \Exception
+ */
+ public static function initDebugLog($path)
+ {
+ if ($path === null || $path === '') {
+ throw new TelegramLogException('Empty path for debug log');
+ }
+ self::initialize();
+ self::$debug_log_path = $path;
+
+ return self::$monolog->pushHandler(
+ (new StreamHandler(self::$debug_log_path, Logger::DEBUG))
+ ->setFormatter(new LineFormatter(null, null, true))
+ );
+ }
+
+ /**
+ * Get the stream handle of the temporary debug output
+ *
+ * @return mixed The stream if debug is active, else false
+ */
+ public static function getDebugLogTempStream()
+ {
+ if (self::$debug_log_temp_stream_handle === null) {
+ if (!self::isDebugLogActive()) {
+ return false;
+ }
+ self::$debug_log_temp_stream_handle = fopen('php://temp', 'w+b');
+ }
+
+ return self::$debug_log_temp_stream_handle;
+ }
+
+ /**
+ * Write the temporary debug stream to log and close the stream handle
+ *
+ * @param string $message Message (with placeholder) to write to the debug log
+ */
+ public static function endDebugLogTempStream($message = '%s')
+ {
+ if (is_resource(self::$debug_log_temp_stream_handle)) {
+ rewind(self::$debug_log_temp_stream_handle);
+ self::debug($message, stream_get_contents(self::$debug_log_temp_stream_handle));
+ fclose(self::$debug_log_temp_stream_handle);
+ self::$debug_log_temp_stream_handle = null;
+ }
+ }
+
+ /**
+ * Initialize update log
+ *
+ * @param string $path
+ *
+ * @return \Monolog\Logger
+ * @throws \Longman\TelegramBot\Exception\TelegramLogException
+ * @throws \InvalidArgumentException
+ * @throws \Exception
+ */
+ public static function initUpdateLog($path)
+ {
+ if ($path === null || $path === '') {
+ throw new TelegramLogException('Empty path for update log');
+ }
+ self::$update_log_path = $path;
+
+ if (self::$monolog_update === null) {
+ self::$monolog_update = new Logger('bot_update_log');
+
+ self::$monolog_update->pushHandler(
+ (new StreamHandler(self::$update_log_path, Logger::INFO))
+ ->setFormatter(new LineFormatter('%message%' . PHP_EOL))
+ );
+ }
+
+ return self::$monolog_update;
+ }
+
+ /**
+ * Is error log active
+ *
+ * @return bool
+ */
+ public static function isErrorLogActive()
+ {
+ return self::$error_log_path !== null;
+ }
+
+ /**
+ * Is debug log active
+ *
+ * @return bool
+ */
+ public static function isDebugLogActive()
+ {
+ return self::$debug_log_path !== null;
+ }
+
+ /**
+ * Is update log active
+ *
+ * @return bool
+ */
+ public static function isUpdateLogActive()
+ {
+ return self::$update_log_path !== null;
+ }
+
+ /**
+ * Report error log
+ *
+ * @param string $text
+ */
+ public static function error($text)
+ {
+ if (self::isErrorLogActive()) {
+ $text = self::getLogText($text, func_get_args());
+ self::$monolog->error($text);
+ }
+ }
+
+ /**
+ * Report debug log
+ *
+ * @param string $text
+ */
+ public static function debug($text)
+ {
+ if (self::isDebugLogActive()) {
+ $text = self::getLogText($text, func_get_args());
+ self::$monolog->debug($text);
+ }
+ }
+
+ /**
+ * Report update log
+ *
+ * @param string $text
+ */
+ public static function update($text)
+ {
+ if (self::isUpdateLogActive()) {
+ $text = self::getLogText($text, func_get_args());
+ self::$monolog_update->info($text);
+ }
+ }
+
+ /**
+ * Applies vsprintf to the text if placeholder replacements are passed along.
+ *
+ * @param string $text
+ * @param array $args
+ *
+ * @return string
+ */
+ protected static function getLogText($text, array $args = [])
+ {
+ // Pop the $text off the array, as it gets passed via func_get_args().
+ array_shift($args);
+
+ // If no placeholders have been passed, don't parse the text.
+ if (empty($args)) {
+ return $text;
+ }
+
+ return vsprintf($text, $args);
+ }
+}
diff --git a/vendor/longman/telegram-bot/structure.sql b/vendor/longman/telegram-bot/structure.sql
new file mode 100644
index 0000000..33e05f0
--- /dev/null
+++ b/vendor/longman/telegram-bot/structure.sql
@@ -0,0 +1,224 @@
+CREATE TABLE IF NOT EXISTS `user` (
+ `id` bigint COMMENT 'Unique user identifier',
+ `is_bot` tinyint(1) DEFAULT 0 COMMENT 'True if this user is a bot',
+ `first_name` CHAR(255) NOT NULL DEFAULT '' COMMENT 'User''s first name',
+ `last_name` CHAR(255) DEFAULT NULL COMMENT 'User''s last name',
+ `username` CHAR(191) DEFAULT NULL COMMENT 'User''s username',
+ `language_code` CHAR(10) DEFAULT NULL COMMENT 'User''s system language',
+ `created_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date creation',
+ `updated_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date update',
+
+ PRIMARY KEY (`id`),
+ KEY `username` (`username`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
+
+CREATE TABLE IF NOT EXISTS `chat` (
+ `id` bigint COMMENT 'Unique user or chat identifier',
+ `type` ENUM('private', 'group', 'supergroup', 'channel') NOT NULL COMMENT 'Chat type, either private, group, supergroup or channel',
+ `title` CHAR(255) DEFAULT '' COMMENT 'Chat (group) title, is null if chat type is private',
+ `username` CHAR(255) DEFAULT NULL COMMENT 'Username, for private chats, supergroups and channels if available',
+ `all_members_are_administrators` tinyint(1) DEFAULT 0 COMMENT 'True if a all members of this group are admins',
+ `created_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date creation',
+ `updated_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date update',
+ `old_id` bigint DEFAULT NULL COMMENT 'Unique chat identifier, this is filled when a group is converted to a supergroup',
+
+ PRIMARY KEY (`id`),
+ KEY `old_id` (`old_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
+
+CREATE TABLE IF NOT EXISTS `user_chat` (
+ `user_id` bigint COMMENT 'Unique user identifier',
+ `chat_id` bigint COMMENT 'Unique user or chat identifier',
+
+ PRIMARY KEY (`user_id`, `chat_id`),
+
+ FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ FOREIGN KEY (`chat_id`) REFERENCES `chat` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
+
+CREATE TABLE IF NOT EXISTS `inline_query` (
+ `id` bigint UNSIGNED COMMENT 'Unique identifier for this query',
+ `user_id` bigint NULL COMMENT 'Unique user identifier',
+ `location` CHAR(255) NULL DEFAULT NULL COMMENT 'Location of the user',
+ `query` TEXT NOT NULL COMMENT 'Text of the query',
+ `offset` CHAR(255) NULL DEFAULT NULL COMMENT 'Offset of the result',
+ `created_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date creation',
+
+ PRIMARY KEY (`id`),
+ KEY `user_id` (`user_id`),
+
+ FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
+
+CREATE TABLE IF NOT EXISTS `chosen_inline_result` (
+ `id` bigint UNSIGNED AUTO_INCREMENT COMMENT 'Unique identifier for this entry',
+ `result_id` CHAR(255) NOT NULL DEFAULT '' COMMENT 'Identifier for this result',
+ `user_id` bigint NULL COMMENT 'Unique user identifier',
+ `location` CHAR(255) NULL DEFAULT NULL COMMENT 'Location object, user''s location',
+ `inline_message_id` CHAR(255) NULL DEFAULT NULL COMMENT 'Identifier of the sent inline message',
+ `query` TEXT NOT NULL COMMENT 'The query that was used to obtain the result',
+ `created_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date creation',
+
+ PRIMARY KEY (`id`),
+ KEY `user_id` (`user_id`),
+
+ FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
+
+CREATE TABLE IF NOT EXISTS `message` (
+ `chat_id` bigint COMMENT 'Unique chat identifier',
+ `id` bigint UNSIGNED COMMENT 'Unique message identifier',
+ `user_id` bigint NULL COMMENT 'Unique user identifier',
+ `date` timestamp NULL DEFAULT NULL COMMENT 'Date the message was sent in timestamp format',
+ `forward_from` bigint NULL DEFAULT NULL COMMENT 'Unique user identifier, sender of the original message',
+ `forward_from_chat` bigint NULL DEFAULT NULL COMMENT 'Unique chat identifier, chat the original message belongs to',
+ `forward_from_message_id` bigint NULL DEFAULT NULL COMMENT 'Unique chat identifier of the original message in the channel',
+ `forward_date` timestamp NULL DEFAULT NULL COMMENT 'date the original message was sent in timestamp format',
+ `reply_to_chat` bigint NULL DEFAULT NULL COMMENT 'Unique chat identifier',
+ `reply_to_message` bigint UNSIGNED DEFAULT NULL COMMENT 'Message that this message is reply to',
+ `media_group_id` TEXT COMMENT 'The unique identifier of a media message group this message belongs to',
+ `text` TEXT COMMENT 'For text messages, the actual UTF-8 text of the message max message length 4096 char utf8mb4',
+ `entities` TEXT COMMENT 'For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text',
+ `audio` TEXT COMMENT 'Audio object. Message is an audio file, information about the file',
+ `document` TEXT COMMENT 'Document object. Message is a general file, information about the file',
+ `photo` TEXT COMMENT 'Array of PhotoSize objects. Message is a photo, available sizes of the photo',
+ `sticker` TEXT COMMENT 'Sticker object. Message is a sticker, information about the sticker',
+ `video` TEXT COMMENT 'Video object. Message is a video, information about the video',
+ `voice` TEXT COMMENT 'Voice Object. Message is a Voice, information about the Voice',
+ `video_note` TEXT COMMENT 'VoiceNote Object. Message is a Video Note, information about the Video Note',
+ `contact` TEXT COMMENT 'Contact object. Message is a shared contact, information about the contact',
+ `location` TEXT COMMENT 'Location object. Message is a shared location, information about the location',
+ `venue` TEXT COMMENT 'Venue object. Message is a Venue, information about the Venue',
+ `caption` TEXT COMMENT 'For message with caption, the actual UTF-8 text of the caption',
+ `new_chat_members` TEXT COMMENT 'List of unique user identifiers, new member(s) were added to the group, information about them (one of these members may be the bot itself)',
+ `left_chat_member` bigint NULL DEFAULT NULL COMMENT 'Unique user identifier, a member was removed from the group, information about them (this member may be the bot itself)',
+ `new_chat_title` CHAR(255) DEFAULT NULL COMMENT 'A chat title was changed to this value',
+ `new_chat_photo` TEXT COMMENT 'Array of PhotoSize objects. A chat photo was change to this value',
+ `delete_chat_photo` tinyint(1) DEFAULT 0 COMMENT 'Informs that the chat photo was deleted',
+ `group_chat_created` tinyint(1) DEFAULT 0 COMMENT 'Informs that the group has been created',
+ `supergroup_chat_created` tinyint(1) DEFAULT 0 COMMENT 'Informs that the supergroup has been created',
+ `channel_chat_created` tinyint(1) DEFAULT 0 COMMENT 'Informs that the channel chat has been created',
+ `migrate_to_chat_id` bigint NULL DEFAULT NULL COMMENT 'Migrate to chat identifier. The group has been migrated to a supergroup with the specified identifier',
+ `migrate_from_chat_id` bigint NULL DEFAULT NULL COMMENT 'Migrate from chat identifier. The supergroup has been migrated from a group with the specified identifier',
+ `pinned_message` TEXT NULL COMMENT 'Message object. Specified message was pinned',
+
+ PRIMARY KEY (`chat_id`, `id`),
+ KEY `user_id` (`user_id`),
+ KEY `forward_from` (`forward_from`),
+ KEY `forward_from_chat` (`forward_from_chat`),
+ KEY `reply_to_chat` (`reply_to_chat`),
+ KEY `reply_to_message` (`reply_to_message`),
+ KEY `left_chat_member` (`left_chat_member`),
+ KEY `migrate_from_chat_id` (`migrate_from_chat_id`),
+ KEY `migrate_to_chat_id` (`migrate_to_chat_id`),
+
+ FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
+ FOREIGN KEY (`chat_id`) REFERENCES `chat` (`id`),
+ FOREIGN KEY (`forward_from`) REFERENCES `user` (`id`),
+ FOREIGN KEY (`forward_from_chat`) REFERENCES `chat` (`id`),
+ FOREIGN KEY (`reply_to_chat`, `reply_to_message`) REFERENCES `message` (`chat_id`, `id`),
+ FOREIGN KEY (`forward_from`) REFERENCES `user` (`id`),
+ FOREIGN KEY (`left_chat_member`) REFERENCES `user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
+
+CREATE TABLE IF NOT EXISTS `callback_query` (
+ `id` bigint UNSIGNED COMMENT 'Unique identifier for this query',
+ `user_id` bigint NULL COMMENT 'Unique user identifier',
+ `chat_id` bigint NULL COMMENT 'Unique chat identifier',
+ `message_id` bigint UNSIGNED COMMENT 'Unique message identifier',
+ `inline_message_id` CHAR(255) NULL DEFAULT NULL COMMENT 'Identifier of the message sent via the bot in inline mode, that originated the query',
+ `data` CHAR(255) NOT NULL DEFAULT '' COMMENT 'Data associated with the callback button',
+ `created_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date creation',
+
+ PRIMARY KEY (`id`),
+ KEY `user_id` (`user_id`),
+ KEY `chat_id` (`chat_id`),
+ KEY `message_id` (`message_id`),
+
+ FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
+ FOREIGN KEY (`chat_id`, `message_id`) REFERENCES `message` (`chat_id`, `id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
+
+CREATE TABLE IF NOT EXISTS `edited_message` (
+ `id` bigint UNSIGNED AUTO_INCREMENT COMMENT 'Unique identifier for this entry',
+ `chat_id` bigint COMMENT 'Unique chat identifier',
+ `message_id` bigint UNSIGNED COMMENT 'Unique message identifier',
+ `user_id` bigint NULL COMMENT 'Unique user identifier',
+ `edit_date` timestamp NULL DEFAULT NULL COMMENT 'Date the message was edited in timestamp format',
+ `text` TEXT COMMENT 'For text messages, the actual UTF-8 text of the message max message length 4096 char utf8',
+ `entities` TEXT COMMENT 'For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text',
+ `caption` TEXT COMMENT 'For message with caption, the actual UTF-8 text of the caption',
+
+ PRIMARY KEY (`id`),
+ KEY `chat_id` (`chat_id`),
+ KEY `message_id` (`message_id`),
+ KEY `user_id` (`user_id`),
+
+ FOREIGN KEY (`chat_id`) REFERENCES `chat` (`id`),
+ FOREIGN KEY (`chat_id`, `message_id`) REFERENCES `message` (`chat_id`, `id`),
+ FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
+
+CREATE TABLE IF NOT EXISTS `telegram_update` (
+ `id` bigint UNSIGNED COMMENT 'Update''s unique identifier',
+ `chat_id` bigint NULL DEFAULT NULL COMMENT 'Unique chat identifier',
+ `message_id` bigint UNSIGNED DEFAULT NULL COMMENT 'Unique message identifier',
+ `inline_query_id` bigint UNSIGNED DEFAULT NULL COMMENT 'Unique inline query identifier',
+ `chosen_inline_result_id` bigint UNSIGNED DEFAULT NULL COMMENT 'Local chosen inline result identifier',
+ `callback_query_id` bigint UNSIGNED DEFAULT NULL COMMENT 'Unique callback query identifier',
+ `edited_message_id` bigint UNSIGNED DEFAULT NULL COMMENT 'Local edited message identifier',
+
+ PRIMARY KEY (`id`),
+ KEY `message_id` (`chat_id`, `message_id`),
+ KEY `inline_query_id` (`inline_query_id`),
+ KEY `chosen_inline_result_id` (`chosen_inline_result_id`),
+ KEY `callback_query_id` (`callback_query_id`),
+ KEY `edited_message_id` (`edited_message_id`),
+
+ FOREIGN KEY (`chat_id`, `message_id`) REFERENCES `message` (`chat_id`, `id`),
+ FOREIGN KEY (`inline_query_id`) REFERENCES `inline_query` (`id`),
+ FOREIGN KEY (`chosen_inline_result_id`) REFERENCES `chosen_inline_result` (`id`),
+ FOREIGN KEY (`callback_query_id`) REFERENCES `callback_query` (`id`),
+ FOREIGN KEY (`edited_message_id`) REFERENCES `edited_message` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
+
+CREATE TABLE IF NOT EXISTS `conversation` (
+ `id` bigint(20) unsigned AUTO_INCREMENT COMMENT 'Unique identifier for this entry',
+ `user_id` bigint NULL DEFAULT NULL COMMENT 'Unique user identifier',
+ `chat_id` bigint NULL DEFAULT NULL COMMENT 'Unique user or chat identifier',
+ `status` ENUM('active', 'cancelled', 'stopped') NOT NULL DEFAULT 'active' COMMENT 'Conversation state',
+ `command` varchar(160) DEFAULT '' COMMENT 'Default command to execute',
+ `notes` text DEFAULT NULL COMMENT 'Data stored from command',
+ `created_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date creation',
+ `updated_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date update',
+
+ PRIMARY KEY (`id`),
+ KEY `user_id` (`user_id`),
+ KEY `chat_id` (`chat_id`),
+ KEY `status` (`status`),
+
+ FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
+ FOREIGN KEY (`chat_id`) REFERENCES `chat` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
+
+CREATE TABLE IF NOT EXISTS `botan_shortener` (
+ `id` bigint UNSIGNED AUTO_INCREMENT COMMENT 'Unique identifier for this entry',
+ `user_id` bigint NULL DEFAULT NULL COMMENT 'Unique user identifier',
+ `url` text NOT NULL COMMENT 'Original URL',
+ `short_url` CHAR(255) NOT NULL DEFAULT '' COMMENT 'Shortened URL',
+ `created_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date creation',
+
+ PRIMARY KEY (`id`),
+
+ FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
+
+CREATE TABLE IF NOT EXISTS `request_limiter` (
+ `id` bigint UNSIGNED AUTO_INCREMENT COMMENT 'Unique identifier for this entry',
+ `chat_id` char(255) NULL DEFAULT NULL COMMENT 'Unique chat identifier',
+ `inline_message_id` char(255) NULL DEFAULT NULL COMMENT 'Identifier of the sent inline message',
+ `method` char(255) DEFAULT NULL COMMENT 'Request method',
+ `created_at` timestamp NULL DEFAULT NULL COMMENT 'Entry date creation',
+
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
diff --git a/vendor/longman/telegram-bot/tests/bootstrap.php b/vendor/longman/telegram-bot/tests/bootstrap.php
new file mode 100644
index 0000000..ad6820c
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/bootstrap.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/*
+ * Set error reporting to the max level.
+ */
+error_reporting(-1);
+
+/*
+ * Set UTC timezone.
+ */
+date_default_timezone_set('UTC');
+
+$autoloader = __DIR__ . '/../vendor/autoload.php';
+
+/*
+ * Check that composer installation was done.
+ */
+if (!file_exists($autoloader)) {
+ throw new Exception(
+ 'Please run "composer install" in root directory to setup unit test dependencies before running the tests'
+ );
+}
+
+// Include the Composer autoloader.
+require_once $autoloader;
+
+/*
+ * Unset global variables that are no longer needed.
+ */
+unset($autoloader);
diff --git a/vendor/longman/telegram-bot/tests/unit/Commands/CommandTest.php b/vendor/longman/telegram-bot/tests/unit/Commands/CommandTest.php
new file mode 100644
index 0000000..962f3ff
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Commands/CommandTest.php
@@ -0,0 +1,183 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit\Commands;
+
+use Longman\TelegramBot\Telegram;
+use Longman\TelegramBot\Tests\Unit\TestCase;
+use Longman\TelegramBot\Tests\Unit\TestHelpers;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class CommandTest extends TestCase
+{
+ /**
+ * @var string
+ */
+ private $command_namespace = 'Longman\TelegramBot\Commands\Command';
+
+ /**
+ * @var \Longman\TelegramBot\Telegram
+ */
+ private $telegram;
+
+ /**
+ * @var \Longman\TelegramBot\Commands\Command
+ */
+ private $command_stub;
+
+ /**
+ * @var \Longman\TelegramBot\Telegram
+ */
+ private $telegram_with_config;
+
+ /**
+ * @var \Longman\TelegramBot\Commands\Command
+ */
+ private $command_stub_with_config;
+
+ public function setUp()
+ {
+ //Default command object
+ $this->telegram = new Telegram(self::$dummy_api_key, 'testbot');
+ $this->command_stub = $this->getMockForAbstractClass($this->command_namespace, [$this->telegram]);
+
+ //Create separate command object that contain a command config
+ $this->telegram_with_config = new Telegram(self::$dummy_api_key, 'testbot');
+ $this->telegram_with_config->setCommandConfig('command_name', ['config_key' => 'config_value']);
+ $this->command_stub_with_config = $this->getMockBuilder($this->command_namespace)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+ //Set a name for the object property so that the constructor can set the config correctly
+ TestHelpers::setObjectProperty($this->command_stub_with_config, 'name', 'command_name');
+ $this->command_stub_with_config->__construct($this->telegram_with_config);
+ }
+
+ // Test idea from here: http://stackoverflow.com/a/4371606
+ public function testCommandConstructorNeedsTelegramObject()
+ {
+ $exception_count = 0;
+ $params_to_test = [
+ [],
+ [null],
+ [12345],
+ ['something'],
+ [new \stdClass],
+ [$this->telegram], // only this one is valid
+ ];
+
+ foreach ($params_to_test as $param) {
+ try {
+ $this->getMockForAbstractClass($this->command_namespace, $param);
+ } catch (\Exception $e) {
+ $exception_count++;
+ } catch (\Throwable $e) { //For PHP7
+ $exception_count++;
+ }
+ }
+
+ $this->assertEquals(5, $exception_count);
+ }
+
+ public function testCommandHasCorrectTelegramObject()
+ {
+ $this->assertAttributeEquals($this->telegram, 'telegram', $this->command_stub);
+ $this->assertSame($this->telegram, $this->command_stub->getTelegram());
+ }
+
+ public function testDefaultCommandName()
+ {
+ $this->assertAttributeEquals('', 'name', $this->command_stub);
+ $this->assertEmpty($this->command_stub->getName());
+ }
+
+ public function testDefaultCommandDescription()
+ {
+ $this->assertAttributeEquals('Command description', 'description', $this->command_stub);
+ $this->assertEquals('Command description', $this->command_stub->getDescription());
+ }
+
+ public function testDefaultCommandUsage()
+ {
+ $this->assertAttributeEquals('Command usage', 'usage', $this->command_stub);
+ $this->assertEquals('Command usage', $this->command_stub->getUsage());
+ }
+
+ public function testDefaultCommandVersion()
+ {
+ $this->assertAttributeEquals('1.0.0', 'version', $this->command_stub);
+ $this->assertEquals('1.0.0', $this->command_stub->getVersion());
+ }
+
+ public function testDefaultCommandIsEnabled()
+ {
+ $this->assertAttributeEquals(true, 'enabled', $this->command_stub);
+ $this->assertTrue($this->command_stub->isEnabled());
+ }
+
+ public function testDefaultCommandShownInHelp()
+ {
+ $this->assertAttributeEquals(true, 'show_in_help', $this->command_stub);
+ $this->assertTrue($this->command_stub->showInHelp());
+ }
+
+ public function testDefaultCommandNeedsMysql()
+ {
+ $this->assertAttributeEquals(false, 'need_mysql', $this->command_stub);
+ }
+
+ public function testDefaultCommandEmptyConfig()
+ {
+ $this->assertAttributeEquals([], 'config', $this->command_stub);
+ }
+
+ public function testDefaultCommandUpdateNull()
+ {
+ $this->assertAttributeEquals(null, 'update', $this->command_stub);
+ }
+
+ public function testCommandSetUpdateAndMessage()
+ {
+ $stub = $this->command_stub;
+
+ $this->assertSame($stub, $stub->setUpdate());
+ $this->assertEquals(null, $stub->getUpdate());
+ $this->assertEquals(null, $stub->getMessage());
+
+ $this->assertSame($stub, $stub->setUpdate(null));
+ $this->assertEquals(null, $stub->getUpdate());
+ $this->assertEquals(null, $stub->getMessage());
+
+ $update = TestHelpers::getFakeUpdateObject();
+ $message = $update->getMessage();
+ $stub->setUpdate($update);
+ $this->assertEquals($update, $stub->getUpdate());
+ $this->assertEquals($message, $stub->getMessage());
+ }
+
+ public function testCommandWithConfigNotEmptyConfig()
+ {
+ $this->assertAttributeNotEmpty('config', $this->command_stub_with_config);
+ }
+
+ public function testCommandWithConfigCorrectConfig()
+ {
+ $this->assertAttributeEquals(['config_key' => 'config_value'], 'config', $this->command_stub_with_config);
+ $this->assertEquals(['config_key' => 'config_value'], $this->command_stub_with_config->getConfig(null));
+ $this->assertEquals(['config_key' => 'config_value'], $this->command_stub_with_config->getConfig());
+ $this->assertEquals('config_value', $this->command_stub_with_config->getConfig('config_key'));
+ $this->assertEquals(null, $this->command_stub_with_config->getConfig('not_config_key'));
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Commands/CommandTestCase.php b/vendor/longman/telegram-bot/tests/unit/Commands/CommandTestCase.php
new file mode 100644
index 0000000..043e367
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Commands/CommandTestCase.php
@@ -0,0 +1,54 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit\Commands;
+
+use Longman\TelegramBot\Telegram;
+use Longman\TelegramBot\Tests\Unit\TestCase;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class CommandTestCase extends TestCase
+{
+ /**
+ * @var \Longman\TelegramBot\Telegram
+ */
+ protected $telegram;
+
+ /**
+ * @var \Longman\TelegramBot\Commands\Command
+ */
+ protected $command;
+
+ /**
+ * setUp
+ */
+ public function setUp()
+ {
+ $this->telegram = new Telegram(self::$dummy_api_key, 'testbot');
+
+ // Add custom commands dedicated to do some tests.
+ $this->telegram->addCommandsPath(__DIR__ . '/CustomTestCommands');
+ $this->telegram->getCommandsList();
+ }
+
+ /**
+ * Make sure the version number is in the format x.x.x, x.x or x
+ */
+ public function testVersionNumberFormat()
+ {
+ $this->assertRegExp('/^(\d+\\.)?(\d+\\.)?(\d+)$/', $this->command->getVersion());
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Commands/CustomTestCommands/HiddenCommand.php b/vendor/longman/telegram-bot/tests/unit/Commands/CustomTestCommands/HiddenCommand.php
new file mode 100644
index 0000000..acc82a1
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Commands/CustomTestCommands/HiddenCommand.php
@@ -0,0 +1,56 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Commands\UserCommands;
+
+use Longman\TelegramBot\Commands\UserCommand;
+use Longman\TelegramBot\Request;
+
+/**
+ * Test "/hidden" command to test $show_in_help
+ */
+class HiddenCommand extends UserCommand
+{
+ /**
+ * @var string
+ */
+ protected $name = 'hidden';
+
+ /**
+ * @var string
+ */
+ protected $description = 'This command is hidden in help';
+
+ /**
+ * @var string
+ */
+ protected $usage = '/hidden';
+
+ /**
+ * @var string
+ */
+ protected $version = '1.0.0';
+
+ /**
+ * @var bool
+ */
+ protected $show_in_help = false;
+
+ /**
+ * Command execute method
+ *
+ * @return mixed
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function execute()
+ {
+ return Request::emptyResponse();
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Commands/CustomTestCommands/VisibleCommand.php b/vendor/longman/telegram-bot/tests/unit/Commands/CustomTestCommands/VisibleCommand.php
new file mode 100644
index 0000000..6d800e8
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Commands/CustomTestCommands/VisibleCommand.php
@@ -0,0 +1,56 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Commands\UserCommands;
+
+use Longman\TelegramBot\Commands\UserCommand;
+use Longman\TelegramBot\Request;
+
+/**
+ * Test "/visible" command to test $show_in_help
+ */
+class VisibleCommand extends UserCommand
+{
+ /**
+ * @var string
+ */
+ protected $name = 'visible';
+
+ /**
+ * @var string
+ */
+ protected $description = 'This command is visible in help';
+
+ /**
+ * @var string
+ */
+ protected $usage = '/visible';
+
+ /**
+ * @var string
+ */
+ protected $version = '1.0.0';
+
+ /**
+ * @var bool
+ */
+ protected $show_in_help = true;
+
+ /**
+ * Command execute method
+ *
+ * @return mixed
+ * @throws \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function execute()
+ {
+ return Request::emptyResponse();
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/ConversationTest.php b/vendor/longman/telegram-bot/tests/unit/ConversationTest.php
new file mode 100644
index 0000000..0bd8b9e
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/ConversationTest.php
@@ -0,0 +1,129 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Conversation;
+use Longman\TelegramBot\Telegram;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class ConversationTest extends TestCase
+{
+ /**
+ * @var \Longman\TelegramBot\Telegram
+ */
+ private $telegram;
+
+ protected function setUp()
+ {
+ $credentials = [
+ 'host' => PHPUNIT_DB_HOST,
+ 'database' => PHPUNIT_DB_NAME,
+ 'user' => PHPUNIT_DB_USER,
+ 'password' => PHPUNIT_DB_PASS,
+ ];
+
+ $this->telegram = new Telegram(self::$dummy_api_key, 'testbot');
+ $this->telegram->enableMySql($credentials);
+
+ //Make sure we start with an empty DB for each test.
+ TestHelpers::emptyDb($credentials);
+ }
+
+ public function testConversationThatDoesntExistPropertiesSetCorrectly()
+ {
+ $conversation = new Conversation(123, 456);
+ $this->assertAttributeEquals(123, 'user_id', $conversation);
+ $this->assertAttributeEquals(456, 'chat_id', $conversation);
+ $this->assertAttributeEquals(null, 'command', $conversation);
+ }
+
+ public function testConversationThatExistsPropertiesSetCorrectly()
+ {
+ $info = TestHelpers::startFakeConversation();
+ $conversation = new Conversation($info['user_id'], $info['chat_id'], 'command');
+ $this->assertAttributeEquals($info['user_id'], 'user_id', $conversation);
+ $this->assertAttributeEquals($info['chat_id'], 'chat_id', $conversation);
+ $this->assertAttributeEquals('command', 'command', $conversation);
+ }
+
+ public function testConversationThatDoesntExistWithoutCommand()
+ {
+ $conversation = new Conversation(1, 1);
+ $this->assertFalse($conversation->exists());
+ $this->assertNull($conversation->getCommand());
+ }
+
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramException
+ */
+ public function testConversationThatDoesntExistWithCommand()
+ {
+ new Conversation(1, 1, 'command');
+ }
+
+ public function testNewConversationThatWontExistWithoutCommand()
+ {
+ TestHelpers::startFakeConversation();
+ $conversation = new Conversation(0, 0);
+ $this->assertFalse($conversation->exists());
+ $this->assertNull($conversation->getCommand());
+ }
+
+ public function testNewConversationThatWillExistWithCommand()
+ {
+ $info = TestHelpers::startFakeConversation();
+ $conversation = new Conversation($info['user_id'], $info['chat_id'], 'command');
+ $this->assertTrue($conversation->exists());
+ $this->assertEquals('command', $conversation->getCommand());
+ }
+
+ public function testStopConversation()
+ {
+ $info = TestHelpers::startFakeConversation();
+ $conversation = new Conversation($info['user_id'], $info['chat_id'], 'command');
+ $this->assertTrue($conversation->exists());
+ $conversation->stop();
+
+ $conversation2 = new Conversation($info['user_id'], $info['chat_id']);
+ $this->assertFalse($conversation2->exists());
+ }
+
+ public function testCancelConversation()
+ {
+ $info = TestHelpers::startFakeConversation();
+ $conversation = new Conversation($info['user_id'], $info['chat_id'], 'command');
+ $this->assertTrue($conversation->exists());
+ $conversation->cancel();
+
+ $conversation2 = new Conversation($info['user_id'], $info['chat_id']);
+ $this->assertFalse($conversation2->exists());
+ }
+
+ public function testUpdateConversationNotes()
+ {
+ $info = TestHelpers::startFakeConversation();
+ $conversation = new Conversation($info['user_id'], $info['chat_id'], 'command');
+ $conversation->notes = 'newnote';
+ $conversation->update();
+
+ $conversation2 = new Conversation($info['user_id'], $info['chat_id'], 'command');
+ $this->assertSame('newnote', $conversation2->notes);
+
+ $conversation3 = new Conversation($info['user_id'], $info['chat_id']);
+ $this->assertSame('newnote', $conversation3->notes);
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/AudioTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/AudioTest.php
new file mode 100644
index 0000000..261d9c0
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/AudioTest.php
@@ -0,0 +1,50 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Entities\Audio;
+
+/**
+ * @package TelegramTest
+ * @author Baev Nikolay
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class AudioTest extends TestCase
+{
+ /**
+ * @var array
+ */
+ private $record;
+
+ public function setUp()
+ {
+ $this->record = TestHelpers::getFakeRecordedAudio();
+ }
+
+ public function testInstance()
+ {
+ $audio = new Audio($this->record);
+ self::assertInstanceOf('Longman\TelegramBot\Entities\Audio', $audio);
+ }
+
+ public function testGetProperties()
+ {
+ $audio = new Audio($this->record);
+ self::assertEquals($this->record['file_id'], $audio->getFileId());
+ self::assertEquals($this->record['duration'], $audio->getDuration());
+ self::assertEquals($this->record['performer'], $audio->getPerformer());
+ self::assertEquals($this->record['title'], $audio->getTitle());
+ self::assertEquals($this->record['mime_type'], $audio->getMimeType());
+ self::assertEquals($this->record['file_size'], $audio->getFileSize());
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/ChatTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/ChatTest.php
new file mode 100644
index 0000000..49bc3b4
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/ChatTest.php
@@ -0,0 +1,70 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class ChatTest extends TestCase
+{
+ public function testChatType()
+ {
+ $chat = TestHelpers::getFakeChatObject();
+ self::assertEquals('private', $chat->getType());
+
+ $chat = TestHelpers::getFakeChatObject(['id' => -123, 'type' => null]);
+ self::assertEquals('group', $chat->getType());
+
+ $chat = TestHelpers::getFakeChatObject(['id' => -123, 'type' => 'supergroup']);
+ self::assertEquals('supergroup', $chat->getType());
+
+ $chat = TestHelpers::getFakeChatObject(['id' => -123, 'type' => 'channel']);
+ self::assertEquals('channel', $chat->getType());
+ }
+
+ public function testIsChatType()
+ {
+ $chat = TestHelpers::getFakeChatObject();
+ self::assertTrue($chat->isPrivateChat());
+
+ $chat = TestHelpers::getFakeChatObject(['id' => -123, 'type' => null]);
+ self::assertTrue($chat->isGroupChat());
+
+ $chat = TestHelpers::getFakeChatObject(['id' => -123, 'type' => 'supergroup']);
+ self::assertTrue($chat->isSuperGroup());
+
+ $chat = TestHelpers::getFakeChatObject(['id' => -123, 'type' => 'channel']);
+ self::assertTrue($chat->isChannel());
+ }
+
+ public function testTryMention()
+ {
+ // Username.
+ $chat = TestHelpers::getFakeChatObject(['id' => 1, 'first_name' => 'John', 'last_name' => 'Taylor', 'username' => 'jtaylor']);
+ self::assertEquals('@jtaylor', $chat->tryMention());
+
+ // First name.
+ $chat = TestHelpers::getFakeChatObject(['id' => 1, 'first_name' => 'John', 'last_name' => null, 'username' => null]);
+ self::assertEquals('John', $chat->tryMention());
+
+ // First and Last name.
+ $chat = TestHelpers::getFakeChatObject(['id' => 1, 'first_name' => 'John', 'last_name' => 'Taylor', 'username' => null]);
+ self::assertEquals('John Taylor', $chat->tryMention());
+
+ // Non-private chat should return title.
+ $chat = TestHelpers::getFakeChatObject(['id' => -123, 'type' => null, 'title' => 'My group chat']);
+ self::assertSame('My group chat', $chat->tryMention());
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/FileTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/FileTest.php
new file mode 100644
index 0000000..91323ec
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/FileTest.php
@@ -0,0 +1,82 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Entities\File;
+
+/**
+ * @package TelegramTest
+ * @author Baev Nikolay
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class FileTest extends TestCase
+{
+ /**
+ * @var array
+ */
+ private $data;
+
+ public function setUp()
+ {
+ $this->data = [
+ 'file_id' => (int) mt_rand(1, 99),
+ 'file_size' => (int) mt_rand(100, 99999),
+ 'file_path' => 'home' . DIRECTORY_SEPARATOR . 'phpunit',
+ ];
+ }
+
+ public function testBaseStageLocation()
+ {
+ $file = new File($this->data);
+ $this->assertInstanceOf('Longman\TelegramBot\Entities\File', $file);
+ }
+
+ public function testGetFileId()
+ {
+ $file = new File($this->data);
+ $id = $file->getFileId();
+ $this->assertInternalType('int', $id);
+ $this->assertEquals($this->data['file_id'], $id);
+ }
+
+ public function testGetFileSize()
+ {
+ $file = new File($this->data);
+ $size = $file->getFileSize();
+ $this->assertInternalType('int', $size);
+ $this->assertEquals($this->data['file_size'], $size);
+ }
+
+ public function testGetFilePath()
+ {
+ $file = new File($this->data);
+ $path = $file->getFilePath();
+ $this->assertEquals($this->data['file_path'], $path);
+ }
+
+ public function testGetFileSizeWithoutData()
+ {
+ unset($this->data['file_size']);
+ $file = new File($this->data);
+ $id = $file->getFileSize();
+ $this->assertNull($id);
+ }
+
+ public function testGetFilePathWithoutData()
+ {
+ unset($this->data['file_path']);
+ $file = new File($this->data);
+ $path = $file->getFilePath();
+ $this->assertNull($path);
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/InlineKeyboardButtonTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/InlineKeyboardButtonTest.php
new file mode 100644
index 0000000..5b2b57a
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/InlineKeyboardButtonTest.php
@@ -0,0 +1,173 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Entities\InlineKeyboardButton;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class InlineKeyboardButtonTest extends TestCase
+{
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramException
+ * @expectedExceptionMessage You must add some text to the button!
+ */
+ public function testInlineKeyboardButtonNoTextFail()
+ {
+ new InlineKeyboardButton([]);
+ }
+
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramException
+ * @expectedExceptionMessage You must use only one of these fields: url, callback_data, switch_inline_query, switch_inline_query_current_chat, pay!
+ */
+ public function testInlineKeyboardButtonNoParameterFail()
+ {
+ new InlineKeyboardButton(['text' => 'message']);
+ }
+
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramException
+ * @expectedExceptionMessage You must use only one of these fields: url, callback_data, switch_inline_query, switch_inline_query_current_chat, pay!
+ */
+ public function testInlineKeyboardButtonTooManyParametersFail()
+ {
+ $test_funcs = [
+ function () {
+ new InlineKeyboardButton([
+ 'text' => 'message',
+ 'url' => 'url_value',
+ 'callback_data' => 'callback_data_value',
+ ]);
+ },
+ function () {
+ new InlineKeyboardButton([
+ 'text' => 'message',
+ 'url' => 'url_value',
+ 'switch_inline_query' => 'switch_inline_query_value',
+ ]);
+ },
+ function () {
+ new InlineKeyboardButton([
+ 'text' => 'message',
+ 'callback_data' => 'callback_data_value',
+ 'switch_inline_query' => 'switch_inline_query_value',
+ ]);
+ },
+ function () {
+ new InlineKeyboardButton([
+ 'text' => 'message',
+ 'callback_data' => 'callback_data_value',
+ 'switch_inline_query_current_chat' => 'switch_inline_query_current_chat_value',
+ ]);
+ },
+ function () {
+ new InlineKeyboardButton([
+ 'text' => 'message',
+ 'callback_data' => 'callback_data_value',
+ 'pay' => true,
+ ]);
+ },
+ ];
+
+ $test_funcs[array_rand($test_funcs)]();
+ }
+
+ public function testInlineKeyboardButtonSuccess()
+ {
+ new InlineKeyboardButton(['text' => 'message', 'url' => 'url_value']);
+ new InlineKeyboardButton(['text' => 'message', 'callback_data' => 'callback_data_value']);
+ new InlineKeyboardButton(['text' => 'message', 'switch_inline_query' => 'switch_inline_query_value']);
+ new InlineKeyboardButton(['text' => 'message', 'switch_inline_query_current_chat' => 'switch_inline_query_current_chat_value']);
+ new InlineKeyboardButton(['text' => 'message', 'pay' => true]);
+ }
+
+ public function testInlineKeyboardButtonCouldBe()
+ {
+ self::assertTrue(InlineKeyboardButton::couldBe(
+ ['text' => 'message', 'url' => 'url_value']
+ ));
+ self::assertTrue(InlineKeyboardButton::couldBe(
+ ['text' => 'message', 'callback_data' => 'callback_data_value']
+ ));
+ self::assertTrue(InlineKeyboardButton::couldBe(
+ ['text' => 'message', 'switch_inline_query' => 'switch_inline_query_value']
+ ));
+ self::assertTrue(InlineKeyboardButton::couldBe(
+ ['text' => 'message', 'switch_inline_query_current_chat' => 'switch_inline_query_current_chat_value']
+ ));
+ self::assertTrue(InlineKeyboardButton::couldBe(
+ ['text' => 'message', 'pay' => true]
+ ));
+
+ self::assertFalse(InlineKeyboardButton::couldBe(['no_text' => 'message']));
+ self::assertFalse(InlineKeyboardButton::couldBe(['text' => 'message']));
+ self::assertFalse(InlineKeyboardButton::couldBe(['url' => 'url_value']));
+ self::assertFalse(InlineKeyboardButton::couldBe(
+ ['callback_data' => 'callback_data_value']
+ ));
+ self::assertFalse(InlineKeyboardButton::couldBe(
+ ['switch_inline_query' => 'switch_inline_query_value']
+ ));
+ self::assertFalse(InlineKeyboardButton::couldBe(['pay' => true]));
+
+ self::assertFalse(InlineKeyboardButton::couldBe([
+ 'url' => 'url_value',
+ 'callback_data' => 'callback_data_value',
+ 'switch_inline_query' => 'switch_inline_query_value',
+ 'switch_inline_query_current_chat' => 'switch_inline_query_current_chat_value',
+ 'pay' => true,
+ ]));
+ }
+
+ public function testInlineKeyboardButtonParameterSetting()
+ {
+ $button = new InlineKeyboardButton(['text' => 'message', 'url' => 'url_value']);
+ self::assertSame('url_value', $button->getUrl());
+ self::assertEmpty($button->getCallbackData());
+ self::assertEmpty($button->getSwitchInlineQuery());
+ self::assertEmpty($button->getSwitchInlineQueryCurrentChat());
+ self::assertEmpty($button->getPay());
+
+ $button->setCallbackData('callback_data_value');
+ self::assertEmpty($button->getUrl());
+ self::assertSame('callback_data_value', $button->getCallbackData());
+ self::assertEmpty($button->getSwitchInlineQuery());
+ self::assertEmpty($button->getSwitchInlineQueryCurrentChat());
+ self::assertEmpty($button->getPay());
+
+ $button->setSwitchInlineQuery('switch_inline_query_value');
+ self::assertEmpty($button->getUrl());
+ self::assertEmpty($button->getCallbackData());
+ self::assertSame('switch_inline_query_value', $button->getSwitchInlineQuery());
+ self::assertEmpty($button->getSwitchInlineQueryCurrentChat());
+ self::assertEmpty($button->getPay());
+
+ $button->setSwitchInlineQueryCurrentChat('switch_inline_query_current_chat_value');
+ self::assertEmpty($button->getUrl());
+ self::assertEmpty($button->getCallbackData());
+ self::assertEmpty($button->getSwitchInlineQuery());
+ self::assertSame('switch_inline_query_current_chat_value', $button->getSwitchInlineQueryCurrentChat());
+ self::assertEmpty($button->getPay());
+
+ $button->setPay(true);
+ self::assertEmpty($button->getUrl());
+ self::assertEmpty($button->getCallbackData());
+ self::assertEmpty($button->getSwitchInlineQuery());
+ self::assertEmpty($button->getSwitchInlineQueryCurrentChat());
+ self::assertSame(true, $button->getPay());
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/InlineKeyboardTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/InlineKeyboardTest.php
new file mode 100644
index 0000000..488f86d
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/InlineKeyboardTest.php
@@ -0,0 +1,138 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Entities\InlineKeyboard;
+use Longman\TelegramBot\Entities\InlineKeyboardButton;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class InlineKeyboardTest extends TestCase
+{
+ private function getRandomButton($text)
+ {
+ $random_params = ['url', 'callback_data', 'switch_inline_query', 'switch_inline_query_current_chat', 'pay'];
+ $param = $random_params[array_rand($random_params, 1)];
+ $data = [
+ 'text' => $text,
+ $param => 'random_param',
+ ];
+
+ return new InlineKeyboardButton($data);
+ }
+
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramException
+ * @expectedExceptionMessage inline_keyboard field is not an array!
+ */
+ public function testInlineKeyboardDataMalformedField()
+ {
+ new InlineKeyboard(['inline_keyboard' => 'wrong']);
+ }
+
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramException
+ * @expectedExceptionMessage inline_keyboard subfield is not an array!
+ */
+ public function testInlineKeyboardDataMalformedSubfield()
+ {
+ new InlineKeyboard(['inline_keyboard' => ['wrong']]);
+ }
+
+ public function testInlineKeyboardSingleButtonSingleRow()
+ {
+ $inline_keyboard = (new InlineKeyboard(
+ $this->getRandomButton('Button Text 1')
+ ))->getProperty('inline_keyboard');
+ self::assertSame('Button Text 1', $inline_keyboard[0][0]->getText());
+
+ $inline_keyboard = (new InlineKeyboard(
+ [$this->getRandomButton('Button Text 2')]
+ ))->getProperty('inline_keyboard');
+ self::assertSame('Button Text 2', $inline_keyboard[0][0]->getText());
+ }
+
+ public function testInlineKeyboardSingleButtonMultipleRows()
+ {
+ $keyboard = (new InlineKeyboard(
+ $this->getRandomButton('Button Text 1'),
+ $this->getRandomButton('Button Text 2'),
+ $this->getRandomButton('Button Text 3')
+ ))->getProperty('inline_keyboard');
+ self::assertSame('Button Text 1', $keyboard[0][0]->getText());
+ self::assertSame('Button Text 2', $keyboard[1][0]->getText());
+ self::assertSame('Button Text 3', $keyboard[2][0]->getText());
+
+ $keyboard = (new InlineKeyboard(
+ [$this->getRandomButton('Button Text 4')],
+ [$this->getRandomButton('Button Text 5')],
+ [$this->getRandomButton('Button Text 6')]
+ ))->getProperty('inline_keyboard');
+ self::assertSame('Button Text 4', $keyboard[0][0]->getText());
+ self::assertSame('Button Text 5', $keyboard[1][0]->getText());
+ self::assertSame('Button Text 6', $keyboard[2][0]->getText());
+ }
+
+ public function testInlineKeyboardMultipleButtonsSingleRow()
+ {
+ $keyboard = (new InlineKeyboard([
+ $this->getRandomButton('Button Text 1'),
+ $this->getRandomButton('Button Text 2'),
+ ]))->getProperty('inline_keyboard');
+ self::assertSame('Button Text 1', $keyboard[0][0]->getText());
+ self::assertSame('Button Text 2', $keyboard[0][1]->getText());
+ }
+
+ public function testInlineKeyboardMultipleButtonsMultipleRows()
+ {
+ $keyboard = (new InlineKeyboard(
+ [
+ $this->getRandomButton('Button Text 1'),
+ $this->getRandomButton('Button Text 2'),
+ ],
+ [
+ $this->getRandomButton('Button Text 3'),
+ $this->getRandomButton('Button Text 4'),
+ ]
+ ))->getProperty('inline_keyboard');
+
+ self::assertSame('Button Text 1', $keyboard[0][0]->getText());
+ self::assertSame('Button Text 2', $keyboard[0][1]->getText());
+ self::assertSame('Button Text 3', $keyboard[1][0]->getText());
+ self::assertSame('Button Text 4', $keyboard[1][1]->getText());
+ }
+
+ public function testInlineKeyboardAddRows()
+ {
+ $keyboard_obj = new InlineKeyboard([]);
+
+ $keyboard_obj->addRow($this->getRandomButton('Button Text 1'));
+ $keyboard = $keyboard_obj->getProperty('inline_keyboard');
+ self::assertSame('Button Text 1', $keyboard[0][0]->getText());
+
+ $keyboard_obj->addRow(
+ $this->getRandomButton('Button Text 2'),
+ $this->getRandomButton('Button Text 3')
+ );
+ $keyboard = $keyboard_obj->getProperty('inline_keyboard');
+ self::assertSame('Button Text 2', $keyboard[1][0]->getText());
+ self::assertSame('Button Text 3', $keyboard[1][1]->getText());
+
+ $keyboard_obj->addRow($this->getRandomButton('Button Text 4'));
+ $keyboard = $keyboard_obj->getProperty('inline_keyboard');
+ self::assertSame('Button Text 4', $keyboard[2][0]->getText());
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/KeyboardButtonTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/KeyboardButtonTest.php
new file mode 100644
index 0000000..018164a
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/KeyboardButtonTest.php
@@ -0,0 +1,69 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Entities\KeyboardButton;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class KeyboardButtonTest extends TestCase
+{
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramException
+ * @expectedExceptionMessage You must add some text to the button!
+ */
+ public function testKeyboardButtonNoTextFail()
+ {
+ new KeyboardButton([]);
+ }
+
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramException
+ * @expectedExceptionMessage You must use only one of these fields: request_contact, request_location!
+ */
+ public function testKeyboardButtonTooManyParametersFail()
+ {
+ new KeyboardButton(['text' => 'message', 'request_contact' => true, 'request_location' => true]);
+ }
+
+ public function testKeyboardButtonSuccess()
+ {
+ new KeyboardButton(['text' => 'message']);
+ new KeyboardButton(['text' => 'message', 'request_contact' => true]);
+ new KeyboardButton(['text' => 'message', 'request_location' => true]);
+ }
+
+ public function testInlineKeyboardButtonCouldBe()
+ {
+ self::assertTrue(KeyboardButton::couldBe(['text' => 'message']));
+ self::assertFalse(KeyboardButton::couldBe(['no_text' => 'message']));
+ }
+
+ public function testKeyboardButtonParameterSetting()
+ {
+ $button = new KeyboardButton('message');
+ self::assertEmpty($button->getRequestContact());
+ self::assertEmpty($button->getRequestLocation());
+
+ $button->setRequestContact(true);
+ self::assertTrue($button->getRequestContact());
+ self::assertEmpty($button->getRequestLocation());
+
+ $button->setRequestLocation(true);
+ self::assertEmpty($button->getRequestContact());
+ self::assertTrue($button->getRequestLocation());
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/KeyboardTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/KeyboardTest.php
new file mode 100644
index 0000000..9708251
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/KeyboardTest.php
@@ -0,0 +1,187 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Entities\Keyboard;
+use Longman\TelegramBot\Entities\KeyboardButton;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class KeyboardTest extends TestCase
+{
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramException
+ * @expectedExceptionMessage keyboard field is not an array!
+ */
+ public function testKeyboardDataMalformedField()
+ {
+ new Keyboard(['keyboard' => 'wrong']);
+ }
+
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramException
+ * @expectedExceptionMessage keyboard subfield is not an array!
+ */
+ public function testKeyboardDataMalformedSubfield()
+ {
+ new Keyboard(['keyboard' => ['wrong']]);
+ }
+
+ public function testKeyboardSingleButtonSingleRow()
+ {
+ $keyboard = (new Keyboard('Button Text 1'))->getProperty('keyboard');
+ self::assertSame('Button Text 1', $keyboard[0][0]->getText());
+
+ $keyboard = (new Keyboard(['Button Text 2']))->getProperty('keyboard');
+ self::assertSame('Button Text 2', $keyboard[0][0]->getText());
+ }
+
+ public function testKeyboardSingleButtonMultipleRows()
+ {
+ $keyboard = (new Keyboard(
+ 'Button Text 1',
+ 'Button Text 2',
+ 'Button Text 3'
+ ))->getProperty('keyboard');
+ self::assertSame('Button Text 1', $keyboard[0][0]->getText());
+ self::assertSame('Button Text 2', $keyboard[1][0]->getText());
+ self::assertSame('Button Text 3', $keyboard[2][0]->getText());
+
+ $keyboard = (new Keyboard(
+ ['Button Text 4'],
+ ['Button Text 5'],
+ ['Button Text 6']
+ ))->getProperty('keyboard');
+ self::assertSame('Button Text 4', $keyboard[0][0]->getText());
+ self::assertSame('Button Text 5', $keyboard[1][0]->getText());
+ self::assertSame('Button Text 6', $keyboard[2][0]->getText());
+ }
+
+ public function testKeyboardMultipleButtonsSingleRow()
+ {
+ $keyboard = (new Keyboard(['Button Text 1', 'Button Text 2']))->getProperty('keyboard');
+ self::assertSame('Button Text 1', $keyboard[0][0]->getText());
+ self::assertSame('Button Text 2', $keyboard[0][1]->getText());
+ }
+
+ public function testKeyboardMultipleButtonsMultipleRows()
+ {
+ $keyboard = (new Keyboard(
+ ['Button Text 1', 'Button Text 2'],
+ ['Button Text 3', 'Button Text 4']
+ ))->getProperty('keyboard');
+
+ self::assertSame('Button Text 1', $keyboard[0][0]->getText());
+ self::assertSame('Button Text 2', $keyboard[0][1]->getText());
+ self::assertSame('Button Text 3', $keyboard[1][0]->getText());
+ self::assertSame('Button Text 4', $keyboard[1][1]->getText());
+ }
+
+ public function testKeyboardWithButtonObjects()
+ {
+ $keyboard = (new Keyboard(
+ new KeyboardButton('Button Text 1')
+ ))->getProperty('keyboard');
+ self::assertSame('Button Text 1', $keyboard[0][0]->getText());
+
+ $keyboard = (new Keyboard(
+ new KeyboardButton('Button Text 2'),
+ new KeyboardButton('Button Text 3')
+ ))->getProperty('keyboard');
+ self::assertSame('Button Text 2', $keyboard[0][0]->getText());
+ self::assertSame('Button Text 3', $keyboard[1][0]->getText());
+
+ $keyboard = (new Keyboard(
+ [new KeyboardButton('Button Text 4')],
+ [new KeyboardButton('Button Text 5'), new KeyboardButton('Button Text 6')]
+ ))->getProperty('keyboard');
+ self::assertSame('Button Text 4', $keyboard[0][0]->getText());
+ self::assertSame('Button Text 5', $keyboard[1][0]->getText());
+ self::assertSame('Button Text 6', $keyboard[1][1]->getText());
+ }
+
+ public function testKeyboardWithDataArray()
+ {
+ $resize_keyboard = (bool) mt_rand(0, 1);
+ $one_time_keyboard = (bool) mt_rand(0, 1);
+ $selective = (bool) mt_rand(0, 1);
+
+ $keyboard_obj = new Keyboard([
+ 'resize_keyboard' => $resize_keyboard,
+ 'one_time_keyboard' => $one_time_keyboard,
+ 'selective' => $selective,
+ 'keyboard' => [['Button Text 1']],
+ ]);
+
+ $keyboard = $keyboard_obj->getProperty('keyboard');
+ self::assertSame('Button Text 1', $keyboard[0][0]->getText());
+
+ self::assertSame($resize_keyboard, $keyboard_obj->getResizeKeyboard());
+ self::assertSame($one_time_keyboard, $keyboard_obj->getOneTimeKeyboard());
+ self::assertSame($selective, $keyboard_obj->getSelective());
+ }
+
+ public function testPredefinedKeyboards()
+ {
+ $keyboard_remove = Keyboard::remove();
+ self::assertTrue($keyboard_remove->getProperty('remove_keyboard'));
+
+ $keyboard_force_reply = Keyboard::forceReply();
+ self::assertTrue($keyboard_force_reply->getProperty('force_reply'));
+ }
+
+ public function testKeyboardMethods()
+ {
+ $keyboard_obj = new Keyboard([]);
+
+ self::assertEmpty($keyboard_obj->getOneTimeKeyboard());
+ self::assertEmpty($keyboard_obj->getResizeKeyboard());
+ self::assertEmpty($keyboard_obj->getSelective());
+
+ $keyboard_obj->setOneTimeKeyboard(true);
+ self::assertTrue($keyboard_obj->getOneTimeKeyboard());
+ $keyboard_obj->setOneTimeKeyboard(false);
+ self::assertFalse($keyboard_obj->getOneTimeKeyboard());
+
+ $keyboard_obj->setResizeKeyboard(true);
+ self::assertTrue($keyboard_obj->getResizeKeyboard());
+ $keyboard_obj->setResizeKeyboard(false);
+ self::assertFalse($keyboard_obj->getResizeKeyboard());
+
+ $keyboard_obj->setSelective(true);
+ self::assertTrue($keyboard_obj->getSelective());
+ $keyboard_obj->setSelective(false);
+ self::assertFalse($keyboard_obj->getSelective());
+ }
+
+ public function testKeyboardAddRows()
+ {
+ $keyboard_obj = new Keyboard([]);
+
+ $keyboard_obj->addRow('Button Text 1');
+ $keyboard = $keyboard_obj->getProperty('keyboard');
+ self::assertSame('Button Text 1', $keyboard[0][0]->getText());
+
+ $keyboard_obj->addRow('Button Text 2', 'Button Text 3');
+ $keyboard = $keyboard_obj->getProperty('keyboard');
+ self::assertSame('Button Text 2', $keyboard[1][0]->getText());
+ self::assertSame('Button Text 3', $keyboard[1][1]->getText());
+
+ $keyboard_obj->addRow(['text' => 'Button Text 4']);
+ $keyboard = $keyboard_obj->getProperty('keyboard');
+ self::assertSame('Button Text 4', $keyboard[2][0]->getText());
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/LocationTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/LocationTest.php
new file mode 100644
index 0000000..e594ba0
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/LocationTest.php
@@ -0,0 +1,55 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Entities\Location;
+
+/**
+ * @package TelegramTest
+ * @author Baev Nikolay
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class LocationTest extends TestCase
+{
+ private $coordinates;
+
+ public function setUp()
+ {
+ $this->coordinates = [
+ 'longitude' => (float) mt_rand(10, 69),
+ 'latitude' => (float) mt_rand(10, 48),
+ ];
+ }
+
+ public function testBaseStageLocation()
+ {
+ $location = new Location($this->coordinates);
+ $this->assertInstanceOf('Longman\TelegramBot\Entities\Location', $location);
+ }
+
+ public function testGetLongitude()
+ {
+ $location = new Location($this->coordinates);
+ $long = $location->getLongitude();
+ $this->assertInternalType('float', $long);
+ $this->assertEquals($this->coordinates['longitude'], $long);
+ }
+
+ public function testGetLatitude()
+ {
+ $location = new Location($this->coordinates);
+ $lat = $location->getLatitude();
+ $this->assertInternalType('float', $lat);
+ $this->assertEquals($this->coordinates['latitude'], $lat);
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/MessageTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/MessageTest.php
new file mode 100644
index 0000000..51477a7
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/MessageTest.php
@@ -0,0 +1,92 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class MessageTest extends TestCase
+{
+ public function testTextAndCommandRecognise()
+ {
+ // /command
+ $message = TestHelpers::getFakeMessageObject(['text' => '/help']);
+ self::assertEquals('/help', $message->getFullCommand());
+ self::assertEquals('help', $message->getCommand());
+ self::assertEquals('/help', $message->getText());
+ self::assertEquals('', $message->getText(true));
+
+ // text
+ $message = TestHelpers::getFakeMessageObject(['text' => 'some text']);
+ self::assertNull($message->getFullCommand());
+ self::assertNull($message->getCommand());
+ self::assertEquals('some text', $message->getText());
+ self::assertEquals('some text', $message->getText(true));
+
+ // /command@bot
+ $message = TestHelpers::getFakeMessageObject(['text' => '/help@testbot']);
+ self::assertEquals('/help@testbot', $message->getFullCommand());
+ self::assertEquals('help', $message->getCommand());
+ self::assertEquals('/help@testbot', $message->getText());
+ self::assertEquals('', $message->getText(true));
+
+ // /commmad text
+ $message = TestHelpers::getFakeMessageObject(['text' => '/help some text']);
+ self::assertEquals('/help', $message->getFullCommand());
+ self::assertEquals('help', $message->getCommand());
+ self::assertEquals('/help some text', $message->getText());
+ self::assertEquals('some text', $message->getText(true));
+
+ // /command@bot some text
+ $message = TestHelpers::getFakeMessageObject(['text' => '/help@testbot some text']);
+ self::assertEquals('/help@testbot', $message->getFullCommand());
+ self::assertEquals('help', $message->getCommand());
+ self::assertEquals('/help@testbot some text', $message->getText());
+ self::assertEquals('some text', $message->getText(true));
+
+ // /commmad\n text
+ $message = TestHelpers::getFakeMessageObject(['text' => "/help\n some text"]);
+ self::assertEquals('/help', $message->getFullCommand());
+ self::assertEquals('help', $message->getCommand());
+ self::assertEquals("/help\n some text", $message->getText());
+ self::assertEquals(' some text', $message->getText(true));
+
+ // /command@bot\nsome text
+ $message = TestHelpers::getFakeMessageObject(['text' => "/help@testbot\nsome text"]);
+ self::assertEquals('/help@testbot', $message->getFullCommand());
+ self::assertEquals('help', $message->getCommand());
+ self::assertEquals("/help@testbot\nsome text", $message->getText());
+ self::assertEquals('some text', $message->getText(true));
+
+ // /command@bot \nsome text
+ $message = TestHelpers::getFakeMessageObject(['text' => "/help@testbot \nsome text"]);
+ self::assertEquals('/help@testbot', $message->getFullCommand());
+ self::assertEquals('help', $message->getCommand());
+ self::assertEquals("/help@testbot \nsome text", $message->getText());
+ self::assertEquals("\nsome text", $message->getText(true));
+ }
+
+ public function testGetType()
+ {
+ $message = TestHelpers::getFakeMessageObject(['text' => null]);
+ self::assertSame('message', $message->getType());
+
+ $message = TestHelpers::getFakeMessageObject(['text' => '/help']);
+ self::assertSame('command', $message->getType());
+
+ $message = TestHelpers::getFakeMessageObject(['text' => 'some text']);
+ self::assertSame('text', $message->getType());
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/ReplyToMessageTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/ReplyToMessageTest.php
new file mode 100644
index 0000000..3250318
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/ReplyToMessageTest.php
@@ -0,0 +1,49 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Entities\Update;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class ReplyToMessageTest extends TestCase
+{
+ public function testChatType()
+ {
+ $json = '{
+ "update_id":137809335,
+ "message":{
+ "message_id":4479,
+ "from":{"id":123,"first_name":"John","username":"MJohn"},
+ "chat":{"id":-123,"title":"MyChat","type":"group"},
+ "date":1449092987,
+ "reply_to_message":{
+ "message_id":11,
+ "from":{"id":121,"first_name":"Myname","username":"mybot"},
+ "chat":{"id":-123,"title":"MyChat","type":"group"},
+ "date":1449092984,
+ "text":"type some text"
+ },
+ "text":"some text"
+ }
+ }';
+
+ $update = new Update(json_decode($json, true), 'mybot');
+ $reply_to_message = $update->getMessage()->getReplyToMessage();
+
+ self::assertNull($reply_to_message->getReplyToMessage());
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/ServerResponseTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/ServerResponseTest.php
new file mode 100644
index 0000000..c321ac4
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/ServerResponseTest.php
@@ -0,0 +1,301 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * Written by Marco Boretto
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Entities\Message;
+use Longman\TelegramBot\Entities\ServerResponse;
+use Longman\TelegramBot\Request;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class ServerResponseTest extends TestCase
+{
+ public function sendMessageOk()
+ {
+ return '{
+ "ok":true,
+ "result":{
+ "message_id":1234,
+ "from":{"id":123456789,"first_name":"botname","username":"namebot"},
+ "chat":{"id":123456789,"first_name":"john","username":"Mjohn"},
+ "date":1441378360,
+ "text":"hello"
+ }
+ }';
+ }
+
+ public function testSendMessageOk()
+ {
+ $result = $this->sendMessageOk();
+ $server = new ServerResponse(json_decode($result, true), 'testbot');
+ $server_result = $server->getResult();
+
+ self::assertTrue($server->isOk());
+ self::assertNull($server->getErrorCode());
+ self::assertNull($server->getDescription());
+ self::assertInstanceOf('\Longman\TelegramBot\Entities\Message', $server_result);
+
+ //Message
+ self::assertEquals('1234', $server_result->getMessageId());
+ self::assertEquals('123456789', $server_result->getFrom()->getId());
+ self::assertEquals('botname', $server_result->getFrom()->getFirstName());
+ self::assertEquals('namebot', $server_result->getFrom()->getUsername());
+ self::assertEquals('123456789', $server_result->getChat()->getId());
+ self::assertEquals('john', $server_result->getChat()->getFirstName());
+ self::assertEquals('Mjohn', $server_result->getChat()->getUsername());
+ self::assertEquals('1441378360', $server_result->getDate());
+ self::assertEquals('hello', $server_result->getText());
+
+ //... they are not finished...
+ }
+
+ public function sendMessageFail()
+ {
+ return '{
+ "ok":false,
+ "error_code":400,
+ "description":"Error: Bad Request: wrong chat id"
+ }';
+ }
+
+ public function testSendMessageFail()
+ {
+ $result = $this->sendMessageFail();
+ $server = new ServerResponse(json_decode($result, true), 'testbot');
+
+ self::assertFalse($server->isOk());
+ self::assertNull($server->getResult());
+ self::assertEquals('400', $server->getErrorCode());
+ self::assertEquals('Error: Bad Request: wrong chat id', $server->getDescription());
+ }
+
+ public function setWebhookOk()
+ {
+ return '{"ok":true,"result":true,"description":"Webhook was set"}';
+ }
+
+ public function testSetWebhookOk()
+ {
+ $result = $this->setWebhookOk();
+ $server = new ServerResponse(json_decode($result, true), 'testbot');
+
+ self::assertTrue($server->isOk());
+ self::assertTrue($server->getResult());
+ self::assertNull($server->getErrorCode());
+ self::assertEquals('Webhook was set', $server->getDescription());
+ }
+
+ public function setWebhookFail()
+ {
+ return '{
+ "ok":false,
+ "error_code":400,
+ "description":"Error: Bad request: htttps:\/\/domain.host.org\/dir\/hook.php"
+ }';
+ }
+
+ public function testSetWebhookFail()
+ {
+ $result = $this->setWebhookFail();
+ $server = new ServerResponse(json_decode($result, true), 'testbot');
+
+ self::assertFalse($server->isOk());
+ self::assertNull($server->getResult());
+ self::assertEquals(400, $server->getErrorCode());
+ self::assertEquals('Error: Bad request: htttps://domain.host.org/dir/hook.php', $server->getDescription());
+ }
+
+ public function getUpdatesArray()
+ {
+ return '{
+ "ok":true,
+ "result":[
+ {
+ "update_id":123,
+ "message":{
+ "message_id":90,
+ "from":{"id":123456789,"first_name":"John","username":"Mjohn"},
+ "chat":{"id":123456789,"first_name":"John","username":"Mjohn"},
+ "date":1441569067,
+ "text":"\/start"
+ }
+ },
+ {
+ "update_id":124,
+ "message":{
+ "message_id":91,
+ "from":{"id":123456788,"first_name":"Patrizia","username":"Patry"},
+ "chat":{"id":123456788,"first_name":"Patrizia","username":"Patry"},
+ "date":1441569073,
+ "text":"Hello!"
+ }
+ },
+ {
+ "update_id":125,
+ "message":{
+ "message_id":92,
+ "from":{"id":123456789,"first_name":"John","username":"MJohn"},
+ "chat":{"id":123456789,"first_name":"John","username":"MJohn"},
+ "date":1441569094,
+ "text":"\/echo hello!"
+ }
+ },
+ {
+ "update_id":126,
+ "message":{
+ "message_id":93,
+ "from":{"id":123456788,"first_name":"Patrizia","username":"Patry"},
+ "chat":{"id":123456788,"first_name":"Patrizia","username":"Patry"},
+ "date":1441569112,
+ "text":"\/echo the best"
+ }
+ }
+ ]
+ }';
+ }
+
+ public function testGetUpdatesArray()
+ {
+ $result = $this->getUpdatesArray();
+ $server = new ServerResponse(json_decode($result, true), 'testbot');
+
+ self::assertCount(4, $server->getResult());
+ self::assertInstanceOf('\Longman\TelegramBot\Entities\Update', $server->getResult()[0]);
+ }
+
+ public function getUpdatesEmpty()
+ {
+ return '{"ok":true,"result":[]}';
+ }
+
+ public function testGetUpdatesEmpty()
+ {
+ $result = $this->getUpdatesEmpty();
+ $server = new ServerResponse(json_decode($result, true), 'testbot');
+
+ self::assertEmpty($server->getResult());
+ }
+
+ public function getUserProfilePhotos()
+ {
+ return '{
+ "ok":true,
+ "result":{
+ "total_count":3,
+ "photos":[
+ [
+ {"file_id":"AgADBG6_vmQaVf3qOGVurBRzHqgg5uEju-8IBAAEC","file_size":7402,"width":160,"height":160},
+ {"file_id":"AgADBG6_vmQaVf3qOGVurBRzHWMuphij6_MIBAAEC","file_size":15882,"width":320,"height":320},
+ {"file_id":"AgADBG6_vmQaVf3qOGVurBRzHNWdpQ9jz_cIBAAEC","file_size":46680,"width":640,"height":640}
+ ],
+ [
+ {"file_id":"AgADBAADr6cxG6_vmH-bksDdiYzAABO8UCGz_JLAAgI","file_size":7324,"width":160,"height":160},
+ {"file_id":"AgADBAADr6cxG6_vmH-bksDdiYzAABAlhB5Q_K0AAgI","file_size":15816,"width":320,"height":320},
+ {"file_id":"AgADBAADr6cxG6_vmH-bksDdiYzAABIIxOSHyayAAgI","file_size":46620,"width":640,"height":640}
+ ],
+ [
+ {"file_id":"AgABxG6_vmQaL2X0CUTAABMhd1n2RLaRSj6cAAgI","file_size":2710,"width":160,"height":160},
+ {"file_id":"AgADcxG6_vmQaL2X0EUTAABPXm1og0O7qwjKcAAgI","file_size":11660,"width":320,"height":320},
+ {"file_id":"AgADxG6_vmQaL2X0CUTAABMOtcfUmoPrcjacAAgI","file_size":37150,"width":640,"height":640}
+ ]
+ ]
+ }
+ }';
+ }
+
+ public function testGetUserProfilePhotos()
+ {
+ $result = $this->getUserProfilePhotos();
+ $server = new ServerResponse(json_decode($result, true), 'testbot');
+ $server_result = $server->getResult();
+
+ $photos = $server_result->getPhotos();
+
+ //Photo count
+ self::assertEquals(3, $server_result->getTotalCount());
+ self::assertCount(3, $photos);
+ //Photo size count
+ self::assertCount(3, $photos[0]);
+
+ self::assertInstanceOf('\Longman\TelegramBot\Entities\UserProfilePhotos', $server_result);
+ self::assertInstanceOf('\Longman\TelegramBot\Entities\PhotoSize', $photos[0][0]);
+ }
+
+ public function getFile()
+ {
+ return '{
+ "ok":true,
+ "result":{
+ "file_id":"AgADBxG6_vmQaVf3qRzHYTAABD1hNWdpQ9qz_cIBAAEC",
+ "file_size":46680,
+ "file_path":"photo\/file_1.jpg"
+ }
+ }';
+ }
+
+ public function testGetFile()
+ {
+ $result = $this->getFile();
+ $server = new ServerResponse(json_decode($result, true), 'testbot');
+
+ self::assertInstanceOf('\Longman\TelegramBot\Entities\File', $server->getResult());
+ }
+
+ public function testSetGeneralTestFakeResponse()
+ {
+ //setWebhook ok
+ $fake_response = Request::generateGeneralFakeServerResponse();
+
+ $server = new ServerResponse($fake_response, 'testbot');
+
+ self::assertTrue($server->isOk());
+ self::assertTrue($server->getResult());
+ self::assertNull($server->getErrorCode());
+ self::assertEquals('', $server->getDescription());
+
+ //sendMessage ok
+ $fake_response = Request::generateGeneralFakeServerResponse(['chat_id' => 123456789, 'text' => 'hello']);
+
+ $server = new ServerResponse($fake_response, 'testbot');
+
+ /** @var Message $server_result */
+ $server_result = $server->getResult();
+
+ self::assertTrue($server->isOk());
+ self::assertNull($server->getErrorCode());
+ self::assertNull($server->getDescription());
+ self::assertInstanceOf('\Longman\TelegramBot\Entities\Message', $server_result);
+
+ //Message
+ self::assertEquals('1234', $server_result->getMessageId());
+ self::assertEquals('1441378360', $server_result->getDate());
+ self::assertEquals('hello', $server_result->getText());
+
+ //Message //User
+ self::assertEquals('123456789', $server_result->getFrom()->getId());
+ self::assertEquals('botname', $server_result->getFrom()->getFirstName());
+ self::assertEquals('namebot', $server_result->getFrom()->getUsername());
+
+ //Message //Chat
+ self::assertEquals('123456789', $server_result->getChat()->getId());
+ self::assertEquals('', $server_result->getChat()->getFirstName());
+ self::assertEquals('', $server_result->getChat()->getUsername());
+
+ //... they are not finished...
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/UpdateTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/UpdateTest.php
new file mode 100644
index 0000000..f632872
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/UpdateTest.php
@@ -0,0 +1,50 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Entities\Update;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class UpdateTest extends TestCase
+{
+ public function testUpdateCast()
+ {
+ $json = '{
+ "update_id":137809336,
+ "message":{
+ "message_id":4479,
+ "from":{"id":123,"first_name":"John","username":"MJohn"},
+ "chat":{"id":-123,"title":"MyChat","type":"group"},
+ "date":1449092987,
+ "reply_to_message":{
+ "message_id":11,
+ "from":{"id":121,"first_name":"Myname","username":"mybot"},
+ "chat":{"id":-123,"title":"MyChat","type":"group"},
+ "date":1449092984,
+ "text":"type some text"
+ },
+ "text":"some text"
+ }
+ }';
+
+ $struct = json_decode($json, true);
+ $update = new Update($struct, 'mybot');
+
+ $array_string_after = json_decode($update->toJson(), true);
+ self::assertEquals($struct, $array_string_after);
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/UserTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/UserTest.php
new file mode 100644
index 0000000..b0edc0d
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/UserTest.php
@@ -0,0 +1,86 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Entities\User;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class UserTest extends TestCase
+{
+ public function testInstance()
+ {
+ $user = new User(['id' => 1]);
+ self::assertInstanceOf('Longman\TelegramBot\Entities\User', $user);
+ }
+
+ public function testGetId()
+ {
+ $user = new User(['id' => 123]);
+ self::assertEquals(123, $user->getId());
+ }
+
+ public function testTryMention()
+ {
+ // Username
+ $user = new User(['id' => 1, 'first_name' => 'John', 'last_name' => 'Taylor', 'username' => 'jtaylor']);
+ self::assertEquals('@jtaylor', $user->tryMention());
+
+ // First name.
+ $user = new User(['id' => 1, 'first_name' => 'John']);
+ self::assertEquals('John', $user->tryMention());
+
+ // First and Last name.
+ $user = new User(['id' => 1, 'first_name' => 'John', 'last_name' => 'Taylor']);
+ self::assertEquals('John Taylor', $user->tryMention());
+ }
+
+ public function testEscapeMarkdown()
+ {
+ // Username.
+ $user = new User(['id' => 1, 'first_name' => 'John', 'last_name' => 'Taylor', 'username' => 'j_taylor']);
+ self::assertEquals('@j_taylor', $user->tryMention());
+ self::assertEquals('@j\_taylor', $user->tryMention(true));
+
+ // First name.
+ $user = new User(['id' => 1, 'first_name' => 'John[']);
+ self::assertEquals('John[', $user->tryMention());
+ self::assertEquals('John\[', $user->tryMention(true));
+
+ // First and Last name.
+ $user = new User(['id' => 1, 'first_name' => 'John', 'last_name' => '`Taylor`']);
+ self::assertEquals('John `Taylor`', $user->tryMention());
+ self::assertEquals('John \`Taylor\`', $user->tryMention(true));
+
+ // Plain escapeMarkdown functionality.
+ self::assertEquals('a\`b\[c\*d\_e', $user->escapeMarkdown('a`b[c*d_e'));
+ }
+
+ public function testGetProperties()
+ {
+ // Username.
+ $user = new User(['id' => 1, 'username' => 'name_phpunit']);
+ self::assertEquals('name_phpunit', $user->getUsername());
+
+ // First name.
+ $user = new User(['id' => 1, 'first_name' => 'name_phpunit']);
+ self::assertEquals('name_phpunit', $user->getFirstName());
+
+ // Last name.
+ $user = new User(['id' => 1, 'last_name' => 'name_phpunit']);
+ self::assertEquals('name_phpunit', $user->getLastName());
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/Entities/WebhookInfoTest.php b/vendor/longman/telegram-bot/tests/unit/Entities/WebhookInfoTest.php
new file mode 100644
index 0000000..1d18b64
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/Entities/WebhookInfoTest.php
@@ -0,0 +1,129 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Entities\WebhookInfo;
+
+/**
+ * @package TelegramTest
+ * @author Baev Nikolay
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class WebhookInfoTest extends TestCase
+{
+ /**
+ * @var array Webhook data
+ */
+ public $data;
+
+ public function setUp()
+ {
+ $this->data = [
+ 'url' => 'http://phpunit',
+ 'has_custom_certificate' => (bool) mt_rand(0, 1),
+ 'pending_update_count' => (int) mt_rand(1, 9),
+ 'last_error_date' => time(),
+ 'last_error_message' => 'Some_error_message',
+ 'max_connections' => (int) mt_rand(1, 100),
+ 'allowed_updates' => ['message', 'edited_channel_post', 'callback_query'],
+ ];
+ }
+
+ public function testBaseStageWebhookInfo()
+ {
+ $webhook = new WebhookInfo($this->data);
+ $this->assertInstanceOf('Longman\TelegramBot\Entities\WebhookInfo', $webhook);
+ }
+
+ public function testGetUrl()
+ {
+ $webhook = new WebhookInfo($this->data);
+ $url = $webhook->getUrl();
+ $this->assertEquals($this->data['url'], $url);
+ }
+
+ public function testGetHasCustomCertificate()
+ {
+ $webhook = new WebhookInfo($this->data);
+ $custom_certificate = $webhook->getHasCustomCertificate();
+ $this->assertInternalType('bool', $custom_certificate);
+ $this->assertEquals($this->data['has_custom_certificate'], $custom_certificate);
+ }
+
+ public function testGetPendingUpdateCount()
+ {
+ $webhook = new WebhookInfo($this->data);
+ $update_count = $webhook->getPendingUpdateCount();
+ $this->assertInternalType('int', $update_count);
+ $this->assertEquals($this->data['pending_update_count'], $update_count);
+ }
+
+ public function testGetLastErrorDate()
+ {
+ $webhook = new WebhookInfo($this->data);
+ $error_date = $webhook->getLastErrorDate();
+ $this->assertInternalType('int', $error_date);
+ $this->assertEquals($this->data['last_error_date'], $error_date);
+ }
+
+ public function testGetLastErrorMessage()
+ {
+ $webhook = new WebhookInfo($this->data);
+ $error_msg = $webhook->getLastErrorMessage();
+ $this->assertInternalType('string', $error_msg);
+ $this->assertEquals($this->data['last_error_message'], $error_msg);
+ }
+
+ public function testGetMaxConnections()
+ {
+ $webhook = new WebhookInfo($this->data);
+ $max_connections = $webhook->getMaxConnections();
+ $this->assertInternalType('int', $max_connections);
+ $this->assertEquals($this->data['max_connections'], $max_connections);
+ }
+
+ public function testGetAllowedUpdates()
+ {
+ $webhook = new WebhookInfo($this->data);
+ $allowed_updates = $webhook->getAllowedUpdates();
+ $this->assertInternalType('array', $allowed_updates);
+ $this->assertEquals($this->data['allowed_updates'], $allowed_updates);
+ }
+
+ public function testGetDataWithoutParams()
+ {
+ // Make a copy to not risk failed tests if not run in proper order.
+ $data = $this->data;
+
+ unset($data['url']);
+ $this->assertNull((new WebhookInfo($data))->getUrl());
+
+ unset($data['has_custom_certificate']);
+ $this->assertNull((new WebhookInfo($data))->getHasCustomCertificate());
+
+ unset($data['pending_update_count']);
+ $this->assertNull((new WebhookInfo($data))->getPendingUpdateCount());
+
+ unset($data['last_error_date']);
+ $this->assertNull((new WebhookInfo($data))->getLastErrorDate());
+
+ unset($data['last_error_message']);
+ $this->assertNull((new WebhookInfo($data))->getLastErrorMessage());
+
+ unset($data['max_connections']);
+ $this->assertNull((new WebhookInfo($data))->getMaxConnections());
+
+ unset($data['allowed_updates']);
+ $this->assertNull((new WebhookInfo($data))->getAllowedUpdates());
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/TelegramLogTest.php b/vendor/longman/telegram-bot/tests/unit/TelegramLogTest.php
new file mode 100644
index 0000000..069e9da
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/TelegramLogTest.php
@@ -0,0 +1,145 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\TelegramLog;
+use Monolog\Handler\StreamHandler;
+use Monolog\Logger;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class TelegramLogTest extends TestCase
+{
+ /**
+ * @var array Dummy logfile paths
+ */
+ private static $logfiles = [
+ 'error' => '/tmp/php-telegram-bot-errorlog.log',
+ 'debug' => '/tmp/php-telegram-bot-debuglog.log',
+ 'update' => '/tmp/php-telegram-bot-updatelog.log',
+ 'external' => '/tmp/php-telegram-bot-externallog.log',
+ ];
+
+ protected function setUp()
+ {
+ // Make sure no monolog instance is set before each test.
+ TestHelpers::setStaticProperty('Longman\TelegramBot\TelegramLog', 'monolog', null);
+ }
+
+ protected function tearDown()
+ {
+ // Make sure no logfiles exist.
+ foreach (self::$logfiles as $file) {
+ file_exists($file) && unlink($file);
+ }
+ }
+
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramLogException
+ */
+ public function testNewInstanceWithoutErrorPath()
+ {
+ TelegramLog::initErrorLog('');
+ }
+
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramLogException
+ */
+ public function testNewInstanceWithoutDebugPath()
+ {
+ TelegramLog::initDebugLog('');
+ }
+
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramLogException
+ */
+ public function testNewInstanceWithoutUpdatePath()
+ {
+ TelegramLog::initUpdateLog('');
+ }
+
+ public function testErrorStream()
+ {
+ $file = self::$logfiles['error'];
+ $this->assertFileNotExists($file);
+ TelegramLog::initErrorLog($file);
+ TelegramLog::error('my error');
+ TelegramLog::error('my 50% error');
+ TelegramLog::error('my %s error', 'placeholder');
+ $this->assertFileExists($file);
+ $error_log = file_get_contents($file);
+ $this->assertContains('bot_log.ERROR: my error', $error_log);
+ $this->assertContains('bot_log.ERROR: my 50% error', $error_log);
+ $this->assertContains('bot_log.ERROR: my placeholder error', $error_log);
+ }
+
+ public function testDebugStream()
+ {
+ $file = self::$logfiles['debug'];
+ $this->assertFileNotExists($file);
+ TelegramLog::initDebugLog($file);
+ TelegramLog::debug('my debug');
+ TelegramLog::debug('my 50% debug');
+ TelegramLog::debug('my %s debug', 'placeholder');
+ $this->assertFileExists($file);
+ $debug_log = file_get_contents($file);
+ $this->assertContains('bot_log.DEBUG: my debug', $debug_log);
+ $this->assertContains('bot_log.DEBUG: my 50% debug', $debug_log);
+ $this->assertContains('bot_log.DEBUG: my placeholder debug', $debug_log);
+ }
+
+ public function testUpdateStream()
+ {
+ $file = self::$logfiles['update'];
+ $this->assertFileNotExists($file);
+ TelegramLog::initUpdateLog($file);
+ TelegramLog::update('my update');
+ TelegramLog::update('my 50% update');
+ TelegramLog::update('my %s update', 'placeholder');
+ $this->assertFileExists($file);
+ $debug_log = file_get_contents($file);
+ $this->assertContains('my update', $debug_log);
+ $this->assertContains('my 50% update', $debug_log);
+ $this->assertContains('my placeholder update', $debug_log);
+ }
+
+ public function testExternalStream()
+ {
+ $file = self::$logfiles['external'];
+ $this->assertFileNotExists($file);
+
+ $external_monolog = new Logger('bot_update_log');
+ $external_monolog->pushHandler(new StreamHandler($file, Logger::ERROR));
+ $external_monolog->pushHandler(new StreamHandler($file, Logger::DEBUG));
+
+ TelegramLog::initialize($external_monolog);
+ TelegramLog::error('my error');
+ TelegramLog::error('my 50% error');
+ TelegramLog::error('my %s error', 'placeholder');
+ TelegramLog::debug('my debug');
+ TelegramLog::debug('my 50% debug');
+ TelegramLog::debug('my %s debug', 'placeholder');
+
+ $this->assertFileExists($file);
+ $file_contents = file_get_contents($file);
+ $this->assertContains('bot_update_log.ERROR: my error', $file_contents);
+ $this->assertContains('bot_update_log.ERROR: my 50% error', $file_contents);
+ $this->assertContains('bot_update_log.ERROR: my placeholder error', $file_contents);
+ $this->assertContains('bot_update_log.DEBUG: my debug', $file_contents);
+ $this->assertContains('bot_update_log.DEBUG: my 50% debug', $file_contents);
+ $this->assertContains('bot_update_log.DEBUG: my placeholder debug', $file_contents);
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/TelegramTest.php b/vendor/longman/telegram-bot/tests/unit/TelegramTest.php
new file mode 100644
index 0000000..e219c75
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/TelegramTest.php
@@ -0,0 +1,147 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\Telegram;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class TelegramTest extends TestCase
+{
+ /**
+ * @var \Longman\TelegramBot\Telegram
+ */
+ private $telegram;
+
+ /**
+ * @var array A few dummy custom commands paths
+ */
+ private $custom_commands_paths = [
+ '/tmp/php-telegram-bot-custom-commands-1',
+ '/tmp/php-telegram-bot-custom-commands-2',
+ '/tmp/php-telegram-bot-custom-commands-3',
+ ];
+
+ protected function setUp()
+ {
+ $this->telegram = new Telegram(self::$dummy_api_key, 'testbot');
+
+ // Create a few dummy custom commands paths.
+ foreach ($this->custom_commands_paths as $custom_path) {
+ mkdir($custom_path);
+ }
+ }
+
+ protected function tearDown()
+ {
+ // Clean up the custom commands paths.
+ foreach ($this->custom_commands_paths as $custom_path) {
+ rmdir($custom_path);
+ }
+ }
+
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramException
+ * @expectedExceptionMessage API KEY not defined!
+ */
+ public function testNewInstanceWithoutApiKeyParam()
+ {
+ new Telegram(null, 'testbot');
+ }
+
+ /**
+ * @expectedException \Longman\TelegramBot\Exception\TelegramException
+ * @expectedExceptionMessage Invalid API KEY defined!
+ */
+ public function testNewInstanceWithInvalidApiKeyParam()
+ {
+ new Telegram('invalid-api-key-format', null);
+ }
+
+ public function testGetApiKey()
+ {
+ $this->assertEquals(self::$dummy_api_key, $this->telegram->getApiKey());
+ }
+
+ public function testGetBotUsername()
+ {
+ $this->assertEquals('testbot', $this->telegram->getBotUsername());
+ }
+
+ public function testEnableAdmins()
+ {
+ $tg = $this->telegram;
+
+ $this->assertEmpty($tg->getAdminList());
+
+ // Single
+ $tg->enableAdmin(1);
+ $this->assertCount(1, $tg->getAdminList());
+
+ // Multiple
+ $tg->enableAdmins([2, 3]);
+ $this->assertCount(3, $tg->getAdminList());
+
+ // Already added
+ $tg->enableAdmin(2);
+ $this->assertCount(3, $tg->getAdminList());
+
+ // Integer as a string
+ $tg->enableAdmin('4');
+ $this->assertCount(3, $tg->getAdminList());
+
+ // Random string
+ $tg->enableAdmin('a string?');
+ $this->assertCount(3, $tg->getAdminList());
+ }
+
+ public function testAddCustomCommandsPaths()
+ {
+ $tg = $this->telegram;
+
+ $this->assertCount(1, $tg->getCommandsPaths());
+
+ $tg->addCommandsPath($this->custom_commands_paths[0]);
+ $this->assertCount(2, $tg->getCommandsPaths());
+ $this->assertArraySubset(
+ [$this->custom_commands_paths[0]],
+ $tg->getCommandsPaths()
+ );
+
+ $tg->addCommandsPath('/invalid/path');
+ $this->assertCount(2, $tg->getCommandsPaths());
+
+ $tg->addCommandsPaths([
+ $this->custom_commands_paths[1],
+ $this->custom_commands_paths[2],
+ ]);
+ $this->assertCount(4, $tg->getCommandsPaths());
+ $this->assertArraySubset(
+ array_reverse($this->custom_commands_paths),
+ $tg->getCommandsPaths()
+ );
+
+ $tg->addCommandsPath($this->custom_commands_paths[0]);
+ $this->assertCount(4, $tg->getCommandsPaths());
+ }
+
+ public function testGetCommandsList()
+ {
+ $commands = $this->telegram->getCommandsList();
+ $this->assertInternalType('array', $commands);
+ $this->assertNotCount(0, $commands);
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/TestCase.php b/vendor/longman/telegram-bot/tests/unit/TestCase.php
new file mode 100644
index 0000000..57dcfd1
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/TestCase.php
@@ -0,0 +1,28 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+class TestCase extends \PHPUnit\Framework\TestCase
+{
+ /**
+ * @var string
+ */
+ public static $dummy_api_key = '123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11';
+
+ protected function skip64BitTest()
+ {
+ if (PHP_INT_SIZE === 4) {
+ $this->markTestSkipped(
+ 'Skipping test that can run only on a 64-bit build of PHP.'
+ );
+ }
+ }
+}
diff --git a/vendor/longman/telegram-bot/tests/unit/TestHelpers.php b/vendor/longman/telegram-bot/tests/unit/TestHelpers.php
new file mode 100644
index 0000000..fe818a9
--- /dev/null
+++ b/vendor/longman/telegram-bot/tests/unit/TestHelpers.php
@@ -0,0 +1,245 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Longman\TelegramBot\Tests\Unit;
+
+use Longman\TelegramBot\DB;
+use Longman\TelegramBot\Entities\Chat;
+use Longman\TelegramBot\Entities\Message;
+use Longman\TelegramBot\Entities\Update;
+use Longman\TelegramBot\Entities\User;
+
+/**
+ * @package TelegramTest
+ * @author Avtandil Kikabidze
+ * @copyright Avtandil Kikabidze
+ * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
+ * @link https://github.com/php-telegram-bot/core
+ */
+class TestHelpers
+{
+ /**
+ * Data template of a user.
+ *
+ * @var array
+ */
+ protected static $user_template = [
+ 'id' => 1,
+ 'first_name' => 'first',
+ 'last_name' => 'last',
+ 'username' => 'user',
+ ];
+
+ /**
+ * Data template of a chat.
+ *
+ * @var array
+ */
+ protected static $chat_template = [
+ 'id' => 1,
+ 'first_name' => 'first',
+ 'last_name' => 'last',
+ 'username' => 'name',
+ 'type' => 'private',
+ 'all_members_are_administrators' => false,
+ ];
+
+ /**
+ * Set the value of a private/protected property of an object
+ *
+ * @param object $object Object that contains the property
+ * @param string $property Name of the property who's value we want to set
+ * @param mixed $value The value to set to the property
+ */
+ public static function setObjectProperty($object, $property, $value)
+ {
+ $ref_object = new \ReflectionObject($object);
+ $ref_property = $ref_object->getProperty($property);
+ $ref_property->setAccessible(true);
+ $ref_property->setValue($object, $value);
+ }
+
+ /**
+ * Set the value of a private/protected static property of a class
+ *
+ * @param string $class Class that contains the static property
+ * @param string $property Name of the property who's value we want to set
+ * @param mixed $value The value to set to the property
+ */
+ public static function setStaticProperty($class, $property, $value)
+ {
+ $ref_property = new \ReflectionProperty($class, $property);
+ $ref_property->setAccessible(true);
+ $ref_property->setValue(null, $value);
+ }
+
+ /**
+ * Return a simple fake Update object
+ *
+ * @param array $data Pass custom data array if needed
+ *
+ * @return \Longman\TelegramBot\Entities\Update
+ */
+ public static function getFakeUpdateObject($data = null)
+ {
+ $data = $data ?: [
+ 'update_id' => mt_rand(),
+ 'message' => [
+ 'message_id' => mt_rand(),
+ 'chat' => [
+ 'id' => mt_rand(),
+ ],
+ 'date' => time(),
+ ],
+ ];
+ return new Update($data, 'testbot');
+ }
+
+ /**
+ * Return a fake command object for the passed command text
+ *
+ * @param string $command_text
+ *
+ * @return \Longman\TelegramBot\Entities\Update
+ */
+ public static function getFakeUpdateCommandObject($command_text)
+ {
+ $data = [
+ 'update_id' => mt_rand(),
+ 'message' => [
+ 'message_id' => mt_rand(),
+ 'from' => self::$user_template,
+ 'chat' => self::$chat_template,
+ 'date' => time(),
+ 'text' => $command_text,
+ ],
+ ];
+ return self::getFakeUpdateObject($data);
+ }
+
+ /**
+ * Return a fake user object.
+ *
+ * @param array $data Pass custom data array if needed
+ *
+ * @return \Longman\TelegramBot\Entities\User
+ */
+ public static function getFakeUserObject(array $data = [])
+ {
+ ($data === null) && $data = [];
+
+ return new User($data + self::$user_template);
+ }
+
+ /**
+ * Return a fake chat object.
+ *
+ * @param array $data Pass custom data array if needed
+ *
+ * @return \Longman\TelegramBot\Entities\Chat
+ */
+ public static function getFakeChatObject(array $data = [])
+ {
+ ($data === null) && $data = [];
+
+ return new Chat($data + self::$chat_template);
+ }
+
+ /**
+ * Get fake recorded audio track
+ *
+ * @return array
+ */
+ public static function getFakeRecordedAudio()
+ {
+ $mime_type = ['audio/ogg', 'audio/mpeg', 'audio/vnd.wave', 'audio/x-ms-wma', 'audio/basic'];
+ $data = [
+ 'file_id' => mt_rand(1, 999),
+ 'duration' => (string) mt_rand(1, 99) . ':' . mt_rand(1, 60),
+ 'performer' => 'phpunit',
+ 'title' => 'track from phpunit',
+ 'mime_type' => $mime_type[array_rand($mime_type, 1)],
+ 'file_size' => mt_rand(1, 99999),
+ ];
+
+ return $data;
+ }
+
+ /**
+ * Return a fake message object using the passed ids.
+ *
+ * @param array $message_data Pass custom message data array if needed
+ * @param array $user_data Pass custom user data array if needed
+ * @param array $chat_data Pass custom chat data array if needed
+ *
+ * @return \Longman\TelegramBot\Entities\Message
+ */
+ public static function getFakeMessageObject(array $message_data = [], array $user_data = [], array $chat_data = [])
+ {
+ ($message_data === null) && $message_data = [];
+ ($user_data === null) && $user_data = [];
+ ($chat_data === null) && $chat_data = [];
+
+ return new Message($message_data + [
+ 'message_id' => mt_rand(),
+ 'from' => $user_data + self::$user_template,
+ 'chat' => $chat_data + self::$chat_template,
+ 'date' => time(),
+ 'text' => 'dummy',
+ ], 'testbot');
+ }
+
+ /**
+ * Start a fake conversation for the passed command and return the randomly generated ids.
+ *
+ * @return array
+ */
+ public static function startFakeConversation()
+ {
+ if (!DB::isDbConnected()) {
+ return false;
+ }
+
+ //Just get some random values.
+ $message_id = mt_rand();
+ $user_id = mt_rand();
+ $chat_id = mt_rand();
+
+ //Make sure we have a valid user and chat available.
+ $message = self::getFakeMessageObject(['message_id' => $message_id], ['id' => $user_id], ['id' => $chat_id]);
+ DB::insertMessageRequest($message);
+ DB::insertUser($message->getFrom(), null, $message->getChat());
+
+ return compact('message_id', 'user_id', 'chat_id');
+ }
+
+ /**
+ * Empty all tables for the passed database
+ *
+ * @param array $credentials
+ */
+ public static function emptyDb(array $credentials)
+ {
+ $dsn = 'mysql:host=' . $credentials['host'] . ';dbname=' . $credentials['database'];
+ $options = [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'];
+
+ $pdo = new \PDO($dsn, $credentials['user'], $credentials['password'], $options);
+ $pdo->prepare('
+ DELETE FROM `conversation`;
+ DELETE FROM `telegram_update`;
+ DELETE FROM `chosen_inline_result`;
+ DELETE FROM `inline_query`;
+ DELETE FROM `message`;
+ DELETE FROM `user_chat`;
+ DELETE FROM `chat`;
+ DELETE FROM `user`;
+ ')->execute();
+ }
+}
diff --git a/vendor/longman/telegram-bot/utils/db-schema-update/0.44.1-0.45.0.sql b/vendor/longman/telegram-bot/utils/db-schema-update/0.44.1-0.45.0.sql
new file mode 100644
index 0000000..98630c2
--- /dev/null
+++ b/vendor/longman/telegram-bot/utils/db-schema-update/0.44.1-0.45.0.sql
@@ -0,0 +1,4 @@
+ALTER TABLE `user` ADD COLUMN `language_code` CHAR(10) DEFAULT NULL COMMENT 'User''s system language' AFTER `username`;
+ALTER TABLE `message` ADD COLUMN `video_note` TEXT COMMENT 'VoiceNote Object. Message is a Video Note, information about the Video Note' AFTER `voice`;
+ALTER TABLE `message` ADD COLUMN `new_chat_members` TEXT COMMENT 'List of unique user identifiers, new member(s) were added to the group, information about them (one of these members may be the bot itself)' AFTER `new_chat_member`;
+UPDATE `message` SET `new_chat_members` = `new_chat_member`;
diff --git a/vendor/longman/telegram-bot/utils/db-schema-update/0.47.1-0.48.0.sql b/vendor/longman/telegram-bot/utils/db-schema-update/0.47.1-0.48.0.sql
new file mode 100644
index 0000000..8513121
--- /dev/null
+++ b/vendor/longman/telegram-bot/utils/db-schema-update/0.47.1-0.48.0.sql
@@ -0,0 +1 @@
+ALTER TABLE `user` ADD COLUMN `is_bot` tinyint(1) DEFAULT 0 COMMENT 'True if this user is a bot' AFTER `id`;
diff --git a/vendor/longman/telegram-bot/utils/db-schema-update/0.50.0-0.51.0.sql b/vendor/longman/telegram-bot/utils/db-schema-update/0.50.0-0.51.0.sql
new file mode 100644
index 0000000..86cae0a
--- /dev/null
+++ b/vendor/longman/telegram-bot/utils/db-schema-update/0.50.0-0.51.0.sql
@@ -0,0 +1 @@
+ALTER TABLE `message` ADD COLUMN `media_group_id` TEXT COMMENT 'The unique identifier of a media message group this message belongs to' AFTER `reply_to_message`;
diff --git a/vendor/longman/telegram-bot/utils/importFromLog.php b/vendor/longman/telegram-bot/utils/importFromLog.php
new file mode 100644
index 0000000..b7083c1
--- /dev/null
+++ b/vendor/longman/telegram-bot/utils/importFromLog.php
@@ -0,0 +1,35 @@
+'localhost', 'user'=>'', 'password'=>'', 'database'=>'');
+
+$update = null;
+try {
+ // Create Telegram API object
+ $telegram = new Longman\TelegramBot\Telegram($API_KEY, $BOT_NAME);
+ $telegram->enableMySQL($CREDENTIALS);
+ foreach (new SplFileObject($filename) as $current_line) {
+ $json_decoded = json_decode($update, true);
+ if (!is_null($json_decoded)) {
+ echo $update . "\n\n";
+ $update = null;
+ if (empty($json_decoded)) {
+ echo "Empty update: \n";
+ echo $update . "\n\n";
+ continue;
+ }
+ $telegram->processUpdate(new Longman\TelegramBot\Entities\Update($json_decoded, $BOT_NAME));
+ }
+ $update .= $current_line;
+ }
+
+} catch (Longman\TelegramBot\Exception\TelegramException $e) {
+ // log telegram errors
+ echo $e;
+}
diff --git a/vendor/monolog/monolog/.php_cs b/vendor/monolog/monolog/.php_cs
new file mode 100644
index 0000000..366ccd0
--- /dev/null
+++ b/vendor/monolog/monolog/.php_cs
@@ -0,0 +1,59 @@
+
+
+For the full copyright and license information, please view the LICENSE
+file that was distributed with this source code.
+EOF;
+
+$finder = Symfony\CS\Finder::create()
+ ->files()
+ ->name('*.php')
+ ->exclude('Fixtures')
+ ->in(__DIR__.'/src')
+ ->in(__DIR__.'/tests')
+;
+
+return Symfony\CS\Config::create()
+ ->setUsingCache(true)
+ //->setUsingLinter(false)
+ ->setRiskyAllowed(true)
+ ->setRules(array(
+ '@PSR2' => true,
+ 'binary_operator_spaces' => true,
+ 'blank_line_before_return' => true,
+ 'header_comment' => array('header' => $header),
+ 'include' => true,
+ 'long_array_syntax' => true,
+ 'method_separation' => true,
+ 'no_blank_lines_after_class_opening' => true,
+ 'no_blank_lines_after_phpdoc' => true,
+ 'no_blank_lines_between_uses' => true,
+ 'no_duplicate_semicolons' => true,
+ 'no_extra_consecutive_blank_lines' => true,
+ 'no_leading_import_slash' => true,
+ 'no_leading_namespace_whitespace' => true,
+ 'no_trailing_comma_in_singleline_array' => true,
+ 'no_unused_imports' => true,
+ 'object_operator_without_whitespace' => true,
+ 'phpdoc_align' => true,
+ 'phpdoc_indent' => true,
+ 'phpdoc_no_access' => true,
+ 'phpdoc_no_package' => true,
+ 'phpdoc_order' => true,
+ 'phpdoc_scalar' => true,
+ 'phpdoc_trim' => true,
+ 'phpdoc_type_to_var' => true,
+ 'psr0' => true,
+ 'single_blank_line_before_namespace' => true,
+ 'spaces_cast' => true,
+ 'standardize_not_equals' => true,
+ 'ternary_operator_spaces' => true,
+ 'trailing_comma_in_multiline_array' => true,
+ 'whitespacy_lines' => true,
+ ))
+ ->finder($finder)
+;
diff --git a/vendor/monolog/monolog/CHANGELOG.md b/vendor/monolog/monolog/CHANGELOG.md
new file mode 100644
index 0000000..cd1142d
--- /dev/null
+++ b/vendor/monolog/monolog/CHANGELOG.md
@@ -0,0 +1,342 @@
+### 1.23.0 (2017-06-19)
+
+ * Improved SyslogUdpHandler's support for RFC5424 and added optional `$ident` argument
+ * Fixed GelfHandler truncation to be per field and not per message
+ * Fixed compatibility issue with PHP <5.3.6
+ * Fixed support for headless Chrome in ChromePHPHandler
+ * Fixed support for latest Aws SDK in DynamoDbHandler
+ * Fixed support for SwiftMailer 6.0+ in SwiftMailerHandler
+
+### 1.22.1 (2017-03-13)
+
+ * Fixed lots of minor issues in the new Slack integrations
+ * Fixed support for allowInlineLineBreaks in LineFormatter when formatting exception backtraces
+
+### 1.22.0 (2016-11-26)
+
+ * Added SlackbotHandler and SlackWebhookHandler to set up Slack integration more easily
+ * Added MercurialProcessor to add mercurial revision and branch names to log records
+ * Added support for AWS SDK v3 in DynamoDbHandler
+ * Fixed fatal errors occuring when normalizing generators that have been fully consumed
+ * Fixed RollbarHandler to include a level (rollbar level), monolog_level (original name), channel and datetime (unix)
+ * Fixed RollbarHandler not flushing records automatically, calling close() explicitly is not necessary anymore
+ * Fixed SyslogUdpHandler to avoid sending empty frames
+ * Fixed a few PHP 7.0 and 7.1 compatibility issues
+
+### 1.21.0 (2016-07-29)
+
+ * Break: Reverted the addition of $context when the ErrorHandler handles regular php errors from 1.20.0 as it was causing issues
+ * Added support for more formats in RotatingFileHandler::setFilenameFormat as long as they have Y, m and d in order
+ * Added ability to format the main line of text the SlackHandler sends by explictly setting a formatter on the handler
+ * Added information about SoapFault instances in NormalizerFormatter
+ * Added $handleOnlyReportedErrors option on ErrorHandler::registerErrorHandler (default true) to allow logging of all errors no matter the error_reporting level
+
+### 1.20.0 (2016-07-02)
+
+ * Added FingersCrossedHandler::activate() to manually trigger the handler regardless of the activation policy
+ * Added StreamHandler::getUrl to retrieve the stream's URL
+ * Added ability to override addRow/addTitle in HtmlFormatter
+ * Added the $context to context information when the ErrorHandler handles a regular php error
+ * Deprecated RotatingFileHandler::setFilenameFormat to only support 3 formats: Y, Y-m and Y-m-d
+ * Fixed WhatFailureGroupHandler to work with PHP7 throwables
+ * Fixed a few minor bugs
+
+### 1.19.0 (2016-04-12)
+
+ * Break: StreamHandler will not close streams automatically that it does not own. If you pass in a stream (not a path/url), then it will not close it for you. You can retrieve those using getStream() if needed
+ * Added DeduplicationHandler to remove duplicate records from notifications across multiple requests, useful for email or other notifications on errors
+ * Added ability to use `%message%` and other LineFormatter replacements in the subject line of emails sent with NativeMailHandler and SwiftMailerHandler
+ * Fixed HipChatHandler handling of long messages
+
+### 1.18.2 (2016-04-02)
+
+ * Fixed ElasticaFormatter to use more precise dates
+ * Fixed GelfMessageFormatter sending too long messages
+
+### 1.18.1 (2016-03-13)
+
+ * Fixed SlackHandler bug where slack dropped messages randomly
+ * Fixed RedisHandler issue when using with the PHPRedis extension
+ * Fixed AmqpHandler content-type being incorrectly set when using with the AMQP extension
+ * Fixed BrowserConsoleHandler regression
+
+### 1.18.0 (2016-03-01)
+
+ * Added optional reduction of timestamp precision via `Logger->useMicrosecondTimestamps(false)`, disabling it gets you a bit of performance boost but reduces the precision to the second instead of microsecond
+ * Added possibility to skip some extra stack frames in IntrospectionProcessor if you have some library wrapping Monolog that is always adding frames
+ * Added `Logger->withName` to clone a logger (keeping all handlers) with a new name
+ * Added FluentdFormatter for the Fluentd unix socket protocol
+ * Added HandlerWrapper base class to ease the creation of handler wrappers, just extend it and override as needed
+ * Added support for replacing context sub-keys using `%context.*%` in LineFormatter
+ * Added support for `payload` context value in RollbarHandler
+ * Added setRelease to RavenHandler to describe the application version, sent with every log
+ * Added support for `fingerprint` context value in RavenHandler
+ * Fixed JSON encoding errors that would gobble up the whole log record, we now handle those more gracefully by dropping chars as needed
+ * Fixed write timeouts in SocketHandler and derivatives, set to 10sec by default, lower it with `setWritingTimeout()`
+ * Fixed PHP7 compatibility with regard to Exception/Throwable handling in a few places
+
+### 1.17.2 (2015-10-14)
+
+ * Fixed ErrorHandler compatibility with non-Monolog PSR-3 loggers
+ * Fixed SlackHandler handling to use slack functionalities better
+ * Fixed SwiftMailerHandler bug when sending multiple emails they all had the same id
+ * Fixed 5.3 compatibility regression
+
+### 1.17.1 (2015-08-31)
+
+ * Fixed RollbarHandler triggering PHP notices
+
+### 1.17.0 (2015-08-30)
+
+ * Added support for `checksum` and `release` context/extra values in RavenHandler
+ * Added better support for exceptions in RollbarHandler
+ * Added UidProcessor::getUid
+ * Added support for showing the resource type in NormalizedFormatter
+ * Fixed IntrospectionProcessor triggering PHP notices
+
+### 1.16.0 (2015-08-09)
+
+ * Added IFTTTHandler to notify ifttt.com triggers
+ * Added Logger::setHandlers() to allow setting/replacing all handlers
+ * Added $capSize in RedisHandler to cap the log size
+ * Fixed StreamHandler creation of directory to only trigger when the first log write happens
+ * Fixed bug in the handling of curl failures
+ * Fixed duplicate logging of fatal errors when both error and fatal error handlers are registered in monolog's ErrorHandler
+ * Fixed missing fatal errors records with handlers that need to be closed to flush log records
+ * Fixed TagProcessor::addTags support for associative arrays
+
+### 1.15.0 (2015-07-12)
+
+ * Added addTags and setTags methods to change a TagProcessor
+ * Added automatic creation of directories if they are missing for a StreamHandler to open a log file
+ * Added retry functionality to Loggly, Cube and Mandrill handlers so they retry up to 5 times in case of network failure
+ * Fixed process exit code being incorrectly reset to 0 if ErrorHandler::registerExceptionHandler was used
+ * Fixed HTML/JS escaping in BrowserConsoleHandler
+ * Fixed JSON encoding errors being silently suppressed (PHP 5.5+ only)
+
+### 1.14.0 (2015-06-19)
+
+ * Added PHPConsoleHandler to send record to Chrome's PHP Console extension and library
+ * Added support for objects implementing __toString in the NormalizerFormatter
+ * Added support for HipChat's v2 API in HipChatHandler
+ * Added Logger::setTimezone() to initialize the timezone monolog should use in case date.timezone isn't correct for your app
+ * Added an option to send formatted message instead of the raw record on PushoverHandler via ->useFormattedMessage(true)
+ * Fixed curl errors being silently suppressed
+
+### 1.13.1 (2015-03-09)
+
+ * Fixed regression in HipChat requiring a new token to be created
+
+### 1.13.0 (2015-03-05)
+
+ * Added Registry::hasLogger to check for the presence of a logger instance
+ * Added context.user support to RavenHandler
+ * Added HipChat API v2 support in the HipChatHandler
+ * Added NativeMailerHandler::addParameter to pass params to the mail() process
+ * Added context data to SlackHandler when $includeContextAndExtra is true
+ * Added ability to customize the Swift_Message per-email in SwiftMailerHandler
+ * Fixed SwiftMailerHandler to lazily create message instances if a callback is provided
+ * Fixed serialization of INF and NaN values in Normalizer and LineFormatter
+
+### 1.12.0 (2014-12-29)
+
+ * Break: HandlerInterface::isHandling now receives a partial record containing only a level key. This was always the intent and does not break any Monolog handler but is strictly speaking a BC break and you should check if you relied on any other field in your own handlers.
+ * Added PsrHandler to forward records to another PSR-3 logger
+ * Added SamplingHandler to wrap around a handler and include only every Nth record
+ * Added MongoDBFormatter to support better storage with MongoDBHandler (it must be enabled manually for now)
+ * Added exception codes in the output of most formatters
+ * Added LineFormatter::includeStacktraces to enable exception stack traces in logs (uses more than one line)
+ * Added $useShortAttachment to SlackHandler to minify attachment size and $includeExtra to append extra data
+ * Added $host to HipChatHandler for users of private instances
+ * Added $transactionName to NewRelicHandler and support for a transaction_name context value
+ * Fixed MandrillHandler to avoid outputing API call responses
+ * Fixed some non-standard behaviors in SyslogUdpHandler
+
+### 1.11.0 (2014-09-30)
+
+ * Break: The NewRelicHandler extra and context data are now prefixed with extra_ and context_ to avoid clashes. Watch out if you have scripts reading those from the API and rely on names
+ * Added WhatFailureGroupHandler to suppress any exception coming from the wrapped handlers and avoid chain failures if a logging service fails
+ * Added MandrillHandler to send emails via the Mandrillapp.com API
+ * Added SlackHandler to log records to a Slack.com account
+ * Added FleepHookHandler to log records to a Fleep.io account
+ * Added LogglyHandler::addTag to allow adding tags to an existing handler
+ * Added $ignoreEmptyContextAndExtra to LineFormatter to avoid empty [] at the end
+ * Added $useLocking to StreamHandler and RotatingFileHandler to enable flock() while writing
+ * Added support for PhpAmqpLib in the AmqpHandler
+ * Added FingersCrossedHandler::clear and BufferHandler::clear to reset them between batches in long running jobs
+ * Added support for adding extra fields from $_SERVER in the WebProcessor
+ * Fixed support for non-string values in PrsLogMessageProcessor
+ * Fixed SwiftMailer messages being sent with the wrong date in long running scripts
+ * Fixed minor PHP 5.6 compatibility issues
+ * Fixed BufferHandler::close being called twice
+
+### 1.10.0 (2014-06-04)
+
+ * Added Logger::getHandlers() and Logger::getProcessors() methods
+ * Added $passthruLevel argument to FingersCrossedHandler to let it always pass some records through even if the trigger level is not reached
+ * Added support for extra data in NewRelicHandler
+ * Added $expandNewlines flag to the ErrorLogHandler to create multiple log entries when a message has multiple lines
+
+### 1.9.1 (2014-04-24)
+
+ * Fixed regression in RotatingFileHandler file permissions
+ * Fixed initialization of the BufferHandler to make sure it gets flushed after receiving records
+ * Fixed ChromePHPHandler and FirePHPHandler's activation strategies to be more conservative
+
+### 1.9.0 (2014-04-20)
+
+ * Added LogEntriesHandler to send logs to a LogEntries account
+ * Added $filePermissions to tweak file mode on StreamHandler and RotatingFileHandler
+ * Added $useFormatting flag to MemoryProcessor to make it send raw data in bytes
+ * Added support for table formatting in FirePHPHandler via the table context key
+ * Added a TagProcessor to add tags to records, and support for tags in RavenHandler
+ * Added $appendNewline flag to the JsonFormatter to enable using it when logging to files
+ * Added sound support to the PushoverHandler
+ * Fixed multi-threading support in StreamHandler
+ * Fixed empty headers issue when ChromePHPHandler received no records
+ * Fixed default format of the ErrorLogHandler
+
+### 1.8.0 (2014-03-23)
+
+ * Break: the LineFormatter now strips newlines by default because this was a bug, set $allowInlineLineBreaks to true if you need them
+ * Added BrowserConsoleHandler to send logs to any browser's console via console.log() injection in the output
+ * Added FilterHandler to filter records and only allow those of a given list of levels through to the wrapped handler
+ * Added FlowdockHandler to send logs to a Flowdock account
+ * Added RollbarHandler to send logs to a Rollbar account
+ * Added HtmlFormatter to send prettier log emails with colors for each log level
+ * Added GitProcessor to add the current branch/commit to extra record data
+ * Added a Monolog\Registry class to allow easier global access to pre-configured loggers
+ * Added support for the new official graylog2/gelf-php lib for GelfHandler, upgrade if you can by replacing the mlehner/gelf-php requirement
+ * Added support for HHVM
+ * Added support for Loggly batch uploads
+ * Added support for tweaking the content type and encoding in NativeMailerHandler
+ * Added $skipClassesPartials to tweak the ignored classes in the IntrospectionProcessor
+ * Fixed batch request support in GelfHandler
+
+### 1.7.0 (2013-11-14)
+
+ * Added ElasticSearchHandler to send logs to an Elastic Search server
+ * Added DynamoDbHandler and ScalarFormatter to send logs to Amazon's Dynamo DB
+ * Added SyslogUdpHandler to send logs to a remote syslogd server
+ * Added LogglyHandler to send logs to a Loggly account
+ * Added $level to IntrospectionProcessor so it only adds backtraces when needed
+ * Added $version to LogstashFormatter to allow using the new v1 Logstash format
+ * Added $appName to NewRelicHandler
+ * Added configuration of Pushover notification retries/expiry
+ * Added $maxColumnWidth to NativeMailerHandler to change the 70 chars default
+ * Added chainability to most setters for all handlers
+ * Fixed RavenHandler batch processing so it takes the message from the record with highest priority
+ * Fixed HipChatHandler batch processing so it sends all messages at once
+ * Fixed issues with eAccelerator
+ * Fixed and improved many small things
+
+### 1.6.0 (2013-07-29)
+
+ * Added HipChatHandler to send logs to a HipChat chat room
+ * Added ErrorLogHandler to send logs to PHP's error_log function
+ * Added NewRelicHandler to send logs to NewRelic's service
+ * Added Monolog\ErrorHandler helper class to register a Logger as exception/error/fatal handler
+ * Added ChannelLevelActivationStrategy for the FingersCrossedHandler to customize levels by channel
+ * Added stack traces output when normalizing exceptions (json output & co)
+ * Added Monolog\Logger::API constant (currently 1)
+ * Added support for ChromePHP's v4.0 extension
+ * Added support for message priorities in PushoverHandler, see $highPriorityLevel and $emergencyLevel
+ * Added support for sending messages to multiple users at once with the PushoverHandler
+ * Fixed RavenHandler's support for batch sending of messages (when behind a Buffer or FingersCrossedHandler)
+ * Fixed normalization of Traversables with very large data sets, only the first 1000 items are shown now
+ * Fixed issue in RotatingFileHandler when an open_basedir restriction is active
+ * Fixed minor issues in RavenHandler and bumped the API to Raven 0.5.0
+ * Fixed SyslogHandler issue when many were used concurrently with different facilities
+
+### 1.5.0 (2013-04-23)
+
+ * Added ProcessIdProcessor to inject the PID in log records
+ * Added UidProcessor to inject a unique identifier to all log records of one request/run
+ * Added support for previous exceptions in the LineFormatter exception serialization
+ * Added Monolog\Logger::getLevels() to get all available levels
+ * Fixed ChromePHPHandler so it avoids sending headers larger than Chrome can handle
+
+### 1.4.1 (2013-04-01)
+
+ * Fixed exception formatting in the LineFormatter to be more minimalistic
+ * Fixed RavenHandler's handling of context/extra data, requires Raven client >0.1.0
+ * Fixed log rotation in RotatingFileHandler to work with long running scripts spanning multiple days
+ * Fixed WebProcessor array access so it checks for data presence
+ * Fixed Buffer, Group and FingersCrossed handlers to make use of their processors
+
+### 1.4.0 (2013-02-13)
+
+ * Added RedisHandler to log to Redis via the Predis library or the phpredis extension
+ * Added ZendMonitorHandler to log to the Zend Server monitor
+ * Added the possibility to pass arrays of handlers and processors directly in the Logger constructor
+ * Added `$useSSL` option to the PushoverHandler which is enabled by default
+ * Fixed ChromePHPHandler and FirePHPHandler issue when multiple instances are used simultaneously
+ * Fixed header injection capability in the NativeMailHandler
+
+### 1.3.1 (2013-01-11)
+
+ * Fixed LogstashFormatter to be usable with stream handlers
+ * Fixed GelfMessageFormatter levels on Windows
+
+### 1.3.0 (2013-01-08)
+
+ * Added PSR-3 compliance, the `Monolog\Logger` class is now an instance of `Psr\Log\LoggerInterface`
+ * Added PsrLogMessageProcessor that you can selectively enable for full PSR-3 compliance
+ * Added LogstashFormatter (combine with SocketHandler or StreamHandler to send logs to Logstash)
+ * Added PushoverHandler to send mobile notifications
+ * Added CouchDBHandler and DoctrineCouchDBHandler
+ * Added RavenHandler to send data to Sentry servers
+ * Added support for the new MongoClient class in MongoDBHandler
+ * Added microsecond precision to log records' timestamps
+ * Added `$flushOnOverflow` param to BufferHandler to flush by batches instead of losing
+ the oldest entries
+ * Fixed normalization of objects with cyclic references
+
+### 1.2.1 (2012-08-29)
+
+ * Added new $logopts arg to SyslogHandler to provide custom openlog options
+ * Fixed fatal error in SyslogHandler
+
+### 1.2.0 (2012-08-18)
+
+ * Added AmqpHandler (for use with AMQP servers)
+ * Added CubeHandler
+ * Added NativeMailerHandler::addHeader() to send custom headers in mails
+ * Added the possibility to specify more than one recipient in NativeMailerHandler
+ * Added the possibility to specify float timeouts in SocketHandler
+ * Added NOTICE and EMERGENCY levels to conform with RFC 5424
+ * Fixed the log records to use the php default timezone instead of UTC
+ * Fixed BufferHandler not being flushed properly on PHP fatal errors
+ * Fixed normalization of exotic resource types
+ * Fixed the default format of the SyslogHandler to avoid duplicating datetimes in syslog
+
+### 1.1.0 (2012-04-23)
+
+ * Added Monolog\Logger::isHandling() to check if a handler will
+ handle the given log level
+ * Added ChromePHPHandler
+ * Added MongoDBHandler
+ * Added GelfHandler (for use with Graylog2 servers)
+ * Added SocketHandler (for use with syslog-ng for example)
+ * Added NormalizerFormatter
+ * Added the possibility to change the activation strategy of the FingersCrossedHandler
+ * Added possibility to show microseconds in logs
+ * Added `server` and `referer` to WebProcessor output
+
+### 1.0.2 (2011-10-24)
+
+ * Fixed bug in IE with large response headers and FirePHPHandler
+
+### 1.0.1 (2011-08-25)
+
+ * Added MemoryPeakUsageProcessor and MemoryUsageProcessor
+ * Added Monolog\Logger::getName() to get a logger's channel name
+
+### 1.0.0 (2011-07-06)
+
+ * Added IntrospectionProcessor to get info from where the logger was called
+ * Fixed WebProcessor in CLI
+
+### 1.0.0-RC1 (2011-07-01)
+
+ * Initial release
diff --git a/vendor/monolog/monolog/LICENSE b/vendor/monolog/monolog/LICENSE
new file mode 100644
index 0000000..1647321
--- /dev/null
+++ b/vendor/monolog/monolog/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2011-2016 Jordi Boggiano
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/monolog/monolog/README.md b/vendor/monolog/monolog/README.md
new file mode 100644
index 0000000..7d8ade5
--- /dev/null
+++ b/vendor/monolog/monolog/README.md
@@ -0,0 +1,95 @@
+# Monolog - Logging for PHP [](https://travis-ci.org/Seldaek/monolog)
+
+[](https://packagist.org/packages/monolog/monolog)
+[](https://packagist.org/packages/monolog/monolog)
+[](https://www.versioneye.com/php/monolog:monolog/references)
+
+
+Monolog sends your logs to files, sockets, inboxes, databases and various
+web services. See the complete list of handlers below. Special handlers
+allow you to build advanced logging strategies.
+
+This library implements the [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
+interface that you can type-hint against in your own libraries to keep
+a maximum of interoperability. You can also use it in your applications to
+make sure you can always use another compatible logger at a later time.
+As of 1.11.0 Monolog public APIs will also accept PSR-3 log levels.
+Internally Monolog still uses its own level scheme since it predates PSR-3.
+
+## Installation
+
+Install the latest version with
+
+```bash
+$ composer require monolog/monolog
+```
+
+## Basic Usage
+
+```php
+pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));
+
+// add records to the log
+$log->addWarning('Foo');
+$log->addError('Bar');
+```
+
+## Documentation
+
+- [Usage Instructions](doc/01-usage.md)
+- [Handlers, Formatters and Processors](doc/02-handlers-formatters-processors.md)
+- [Utility classes](doc/03-utilities.md)
+- [Extending Monolog](doc/04-extending.md)
+
+## Third Party Packages
+
+Third party handlers, formatters and processors are
+[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You
+can also add your own there if you publish one.
+
+## About
+
+### Requirements
+
+- Monolog works with PHP 5.3 or above, and is also tested to work with HHVM.
+
+### Submitting bugs and feature requests
+
+Bugs and feature request are tracked on [GitHub](https://github.com/Seldaek/monolog/issues)
+
+### Framework Integrations
+
+- Frameworks and libraries using [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
+ can be used very easily with Monolog since it implements the interface.
+- [Symfony2](http://symfony.com) comes out of the box with Monolog.
+- [Silex](http://silex.sensiolabs.org/) comes out of the box with Monolog.
+- [Laravel 4 & 5](http://laravel.com/) come out of the box with Monolog.
+- [Lumen](http://lumen.laravel.com/) comes out of the box with Monolog.
+- [PPI](http://www.ppi.io/) comes out of the box with Monolog.
+- [CakePHP](http://cakephp.org/) is usable with Monolog via the [cakephp-monolog](https://github.com/jadb/cakephp-monolog) plugin.
+- [Slim](http://www.slimframework.com/) is usable with Monolog via the [Slim-Monolog](https://github.com/Flynsarmy/Slim-Monolog) log writer.
+- [XOOPS 2.6](http://xoops.org/) comes out of the box with Monolog.
+- [Aura.Web_Project](https://github.com/auraphp/Aura.Web_Project) comes out of the box with Monolog.
+- [Nette Framework](http://nette.org/en/) can be used with Monolog via [Kdyby/Monolog](https://github.com/Kdyby/Monolog) extension.
+- [Proton Micro Framework](https://github.com/alexbilbie/Proton) comes out of the box with Monolog.
+
+### Author
+
+Jordi Boggiano - -
+See also the list of [contributors](https://github.com/Seldaek/monolog/contributors) which participated in this project.
+
+### License
+
+Monolog is licensed under the MIT License - see the `LICENSE` file for details
+
+### Acknowledgements
+
+This library is heavily inspired by Python's [Logbook](http://packages.python.org/Logbook/)
+library, although most concepts have been adjusted to fit to the PHP world.
diff --git a/vendor/monolog/monolog/composer.json b/vendor/monolog/monolog/composer.json
new file mode 100644
index 0000000..3b0c880
--- /dev/null
+++ b/vendor/monolog/monolog/composer.json
@@ -0,0 +1,66 @@
+{
+ "name": "monolog/monolog",
+ "description": "Sends your logs to files, sockets, inboxes, databases and various web services",
+ "keywords": ["log", "logging", "psr-3"],
+ "homepage": "http://github.com/Seldaek/monolog",
+ "type": "library",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be",
+ "homepage": "http://seld.be"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.0",
+ "psr/log": "~1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.5",
+ "graylog2/gelf-php": "~1.0",
+ "sentry/sentry": "^0.13",
+ "ruflin/elastica": ">=0.90 <3.0",
+ "doctrine/couchdb": "~1.0@dev",
+ "aws/aws-sdk-php": "^2.4.9 || ^3.0",
+ "php-amqplib/php-amqplib": "~2.4",
+ "swiftmailer/swiftmailer": "^5.3|^6.0",
+ "php-console/php-console": "^3.1.3",
+ "phpunit/phpunit-mock-objects": "2.3.0",
+ "jakub-onderka/php-parallel-lint": "0.9"
+ },
+ "_": "phpunit/phpunit-mock-objects required in 2.3.0 due to https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223 - needs hhvm 3.8+ on travis",
+ "suggest": {
+ "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
+ "sentry/sentry": "Allow sending log messages to a Sentry server",
+ "doctrine/couchdb": "Allow sending log messages to a CouchDB server",
+ "ruflin/elastica": "Allow sending log messages to an Elastic Search server",
+ "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
+ "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
+ "ext-mongo": "Allow sending log messages to a MongoDB server",
+ "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
+ "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
+ "rollbar/rollbar": "Allow sending log messages to Rollbar",
+ "php-console/php-console": "Allow sending log messages to Google Chrome"
+ },
+ "autoload": {
+ "psr-4": {"Monolog\\": "src/Monolog"}
+ },
+ "autoload-dev": {
+ "psr-4": {"Monolog\\": "tests/Monolog"}
+ },
+ "provide": {
+ "psr/log-implementation": "1.0.0"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "scripts": {
+ "test": [
+ "parallel-lint . --exclude vendor",
+ "phpunit"
+ ]
+ }
+}
diff --git a/vendor/monolog/monolog/doc/01-usage.md b/vendor/monolog/monolog/doc/01-usage.md
new file mode 100644
index 0000000..8e2551f
--- /dev/null
+++ b/vendor/monolog/monolog/doc/01-usage.md
@@ -0,0 +1,231 @@
+# Using Monolog
+
+- [Installation](#installation)
+- [Core Concepts](#core-concepts)
+- [Log Levels](#log-levels)
+- [Configuring a logger](#configuring-a-logger)
+- [Adding extra data in the records](#adding-extra-data-in-the-records)
+- [Leveraging channels](#leveraging-channels)
+- [Customizing the log format](#customizing-the-log-format)
+
+## Installation
+
+Monolog is available on Packagist ([monolog/monolog](http://packagist.org/packages/monolog/monolog))
+and as such installable via [Composer](http://getcomposer.org/).
+
+```bash
+composer require monolog/monolog
+```
+
+If you do not use Composer, you can grab the code from GitHub, and use any
+PSR-0 compatible autoloader (e.g. the [Symfony2 ClassLoader component](https://github.com/symfony/ClassLoader))
+to load Monolog classes.
+
+## Core Concepts
+
+Every `Logger` instance has a channel (name) and a stack of handlers. Whenever
+you add a record to the logger, it traverses the handler stack. Each handler
+decides whether it fully handled the record, and if so, the propagation of the
+record ends there.
+
+This allows for flexible logging setups, for example having a `StreamHandler` at
+the bottom of the stack that will log anything to disk, and on top of that add
+a `MailHandler` that will send emails only when an error message is logged.
+Handlers also have a `$bubble` property which defines whether they block the
+record or not if they handled it. In this example, setting the `MailHandler`'s
+`$bubble` argument to false means that records handled by the `MailHandler` will
+not propagate to the `StreamHandler` anymore.
+
+You can create many `Logger`s, each defining a channel (e.g.: db, request,
+router, ..) and each of them combining various handlers, which can be shared
+or not. The channel is reflected in the logs and allows you to easily see or
+filter records.
+
+Each Handler also has a Formatter, a default one with settings that make sense
+will be created if you don't set one. The formatters normalize and format
+incoming records so that they can be used by the handlers to output useful
+information.
+
+Custom severity levels are not available. Only the eight
+[RFC 5424](http://tools.ietf.org/html/rfc5424) levels (debug, info, notice,
+warning, error, critical, alert, emergency) are present for basic filtering
+purposes, but for sorting and other use cases that would require
+flexibility, you should add Processors to the Logger that can add extra
+information (tags, user ip, ..) to the records before they are handled.
+
+## Log Levels
+
+Monolog supports the logging levels described by [RFC 5424](http://tools.ietf.org/html/rfc5424).
+
+- **DEBUG** (100): Detailed debug information.
+
+- **INFO** (200): Interesting events. Examples: User logs in, SQL logs.
+
+- **NOTICE** (250): Normal but significant events.
+
+- **WARNING** (300): Exceptional occurrences that are not errors. Examples:
+ Use of deprecated APIs, poor use of an API, undesirable things that are not
+ necessarily wrong.
+
+- **ERROR** (400): Runtime errors that do not require immediate action but
+ should typically be logged and monitored.
+
+- **CRITICAL** (500): Critical conditions. Example: Application component
+ unavailable, unexpected exception.
+
+- **ALERT** (550): Action must be taken immediately. Example: Entire website
+ down, database unavailable, etc. This should trigger the SMS alerts and wake
+ you up.
+
+- **EMERGENCY** (600): Emergency: system is unusable.
+
+## Configuring a logger
+
+Here is a basic setup to log to a file and to firephp on the DEBUG level:
+
+```php
+pushHandler(new StreamHandler(__DIR__.'/my_app.log', Logger::DEBUG));
+$logger->pushHandler(new FirePHPHandler());
+
+// You can now use your logger
+$logger->addInfo('My logger is now ready');
+```
+
+Let's explain it. The first step is to create the logger instance which will
+be used in your code. The argument is a channel name, which is useful when
+you use several loggers (see below for more details about it).
+
+The logger itself does not know how to handle a record. It delegates it to
+some handlers. The code above registers two handlers in the stack to allow
+handling records in two different ways.
+
+Note that the FirePHPHandler is called first as it is added on top of the
+stack. This allows you to temporarily add a logger with bubbling disabled if
+you want to override other configured loggers.
+
+> If you use Monolog standalone and are looking for an easy way to
+> configure many handlers, the [theorchard/monolog-cascade](https://github.com/theorchard/monolog-cascade)
+> can help you build complex logging configs via PHP arrays, yaml or json configs.
+
+## Adding extra data in the records
+
+Monolog provides two different ways to add extra informations along the simple
+textual message.
+
+### Using the logging context
+
+The first way is the context, allowing to pass an array of data along the
+record:
+
+```php
+addInfo('Adding a new user', array('username' => 'Seldaek'));
+```
+
+Simple handlers (like the StreamHandler for instance) will simply format
+the array to a string but richer handlers can take advantage of the context
+(FirePHP is able to display arrays in pretty way for instance).
+
+### Using processors
+
+The second way is to add extra data for all records by using a processor.
+Processors can be any callable. They will get the record as parameter and
+must return it after having eventually changed the `extra` part of it. Let's
+write a processor adding some dummy data in the record:
+
+```php
+pushProcessor(function ($record) {
+ $record['extra']['dummy'] = 'Hello world!';
+
+ return $record;
+});
+```
+
+Monolog provides some built-in processors that can be used in your project.
+Look at the [dedicated chapter](https://github.com/Seldaek/monolog/blob/master/doc/02-handlers-formatters-processors.md#processors) for the list.
+
+> Tip: processors can also be registered on a specific handler instead of
+ the logger to apply only for this handler.
+
+## Leveraging channels
+
+Channels are a great way to identify to which part of the application a record
+is related. This is useful in big applications (and is leveraged by
+MonologBundle in Symfony2).
+
+Picture two loggers sharing a handler that writes to a single log file.
+Channels would allow you to identify the logger that issued every record.
+You can easily grep through the log files filtering this or that channel.
+
+```php
+pushHandler($stream);
+$logger->pushHandler($firephp);
+
+// Create a logger for the security-related stuff with a different channel
+$securityLogger = new Logger('security');
+$securityLogger->pushHandler($stream);
+$securityLogger->pushHandler($firephp);
+
+// Or clone the first one to only change the channel
+$securityLogger = $logger->withName('security');
+```
+
+## Customizing the log format
+
+In Monolog it's easy to customize the format of the logs written into files,
+sockets, mails, databases and other handlers. Most of the handlers use the
+
+```php
+$record['formatted']
+```
+
+value to be automatically put into the log device. This value depends on the
+formatter settings. You can choose between predefined formatter classes or
+write your own (e.g. a multiline text file for human-readable output).
+
+To configure a predefined formatter class, just set it as the handler's field:
+
+```php
+// the default date format is "Y-m-d H:i:s"
+$dateFormat = "Y n j, g:i a";
+// the default output format is "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"
+$output = "%datetime% > %level_name% > %message% %context% %extra%\n";
+// finally, create a formatter
+$formatter = new LineFormatter($output, $dateFormat);
+
+// Create a handler
+$stream = new StreamHandler(__DIR__.'/my_app.log', Logger::DEBUG);
+$stream->setFormatter($formatter);
+// bind it to a logger object
+$securityLogger = new Logger('security');
+$securityLogger->pushHandler($stream);
+```
+
+You may also reuse the same formatter between multiple handlers and share those
+handlers between multiple loggers.
+
+[Handlers, Formatters and Processors](02-handlers-formatters-processors.md) →
diff --git a/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md b/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md
new file mode 100644
index 0000000..bea968a
--- /dev/null
+++ b/vendor/monolog/monolog/doc/02-handlers-formatters-processors.md
@@ -0,0 +1,157 @@
+# Handlers, Formatters and Processors
+
+- [Handlers](#handlers)
+ - [Log to files and syslog](#log-to-files-and-syslog)
+ - [Send alerts and emails](#send-alerts-and-emails)
+ - [Log specific servers and networked logging](#log-specific-servers-and-networked-logging)
+ - [Logging in development](#logging-in-development)
+ - [Log to databases](#log-to-databases)
+ - [Wrappers / Special Handlers](#wrappers--special-handlers)
+- [Formatters](#formatters)
+- [Processors](#processors)
+- [Third Party Packages](#third-party-packages)
+
+## Handlers
+
+### Log to files and syslog
+
+- _StreamHandler_: Logs records into any PHP stream, use this for log files.
+- _RotatingFileHandler_: Logs records to a file and creates one logfile per day.
+ It will also delete files older than `$maxFiles`. You should use
+ [logrotate](http://linuxcommand.org/man_pages/logrotate8.html) for high profile
+ setups though, this is just meant as a quick and dirty solution.
+- _SyslogHandler_: Logs records to the syslog.
+- _ErrorLogHandler_: Logs records to PHP's
+ [`error_log()`](http://docs.php.net/manual/en/function.error-log.php) function.
+
+### Send alerts and emails
+
+- _NativeMailerHandler_: Sends emails using PHP's
+ [`mail()`](http://php.net/manual/en/function.mail.php) function.
+- _SwiftMailerHandler_: Sends emails using a [`Swift_Mailer`](http://swiftmailer.org/) instance.
+- _PushoverHandler_: Sends mobile notifications via the [Pushover](https://www.pushover.net/) API.
+- _HipChatHandler_: Logs records to a [HipChat](http://hipchat.com) chat room using its API.
+- _FlowdockHandler_: Logs records to a [Flowdock](https://www.flowdock.com/) account.
+- _SlackHandler_: Logs records to a [Slack](https://www.slack.com/) account using the Slack API.
+- _SlackbotHandler_: Logs records to a [Slack](https://www.slack.com/) account using the Slackbot incoming hook.
+- _SlackWebhookHandler_: Logs records to a [Slack](https://www.slack.com/) account using Slack Webhooks.
+- _MandrillHandler_: Sends emails via the Mandrill API using a [`Swift_Message`](http://swiftmailer.org/) instance.
+- _FleepHookHandler_: Logs records to a [Fleep](https://fleep.io/) conversation using Webhooks.
+- _IFTTTHandler_: Notifies an [IFTTT](https://ifttt.com/maker) trigger with the log channel, level name and message.
+
+### Log specific servers and networked logging
+
+- _SocketHandler_: Logs records to [sockets](http://php.net/fsockopen), use this
+ for UNIX and TCP sockets. See an [example](sockets.md).
+- _AmqpHandler_: Logs records to an [amqp](http://www.amqp.org/) compatible
+ server. Requires the [php-amqp](http://pecl.php.net/package/amqp) extension (1.0+).
+- _GelfHandler_: Logs records to a [Graylog2](http://www.graylog2.org) server.
+- _CubeHandler_: Logs records to a [Cube](http://square.github.com/cube/) server.
+- _RavenHandler_: Logs records to a [Sentry](http://getsentry.com/) server using
+ [raven](https://packagist.org/packages/raven/raven).
+- _ZendMonitorHandler_: Logs records to the Zend Monitor present in Zend Server.
+- _NewRelicHandler_: Logs records to a [NewRelic](http://newrelic.com/) application.
+- _LogglyHandler_: Logs records to a [Loggly](http://www.loggly.com/) account.
+- _RollbarHandler_: Logs records to a [Rollbar](https://rollbar.com/) account.
+- _SyslogUdpHandler_: Logs records to a remote [Syslogd](http://www.rsyslog.com/) server.
+- _LogEntriesHandler_: Logs records to a [LogEntries](http://logentries.com/) account.
+
+### Logging in development
+
+- _FirePHPHandler_: Handler for [FirePHP](http://www.firephp.org/), providing
+ inline `console` messages within [FireBug](http://getfirebug.com/).
+- _ChromePHPHandler_: Handler for [ChromePHP](http://www.chromephp.com/), providing
+ inline `console` messages within Chrome.
+- _BrowserConsoleHandler_: Handler to send logs to browser's Javascript `console` with
+ no browser extension required. Most browsers supporting `console` API are supported.
+- _PHPConsoleHandler_: Handler for [PHP Console](https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef), providing
+ inline `console` and notification popup messages within Chrome.
+
+### Log to databases
+
+- _RedisHandler_: Logs records to a [redis](http://redis.io) server.
+- _MongoDBHandler_: Handler to write records in MongoDB via a
+ [Mongo](http://pecl.php.net/package/mongo) extension connection.
+- _CouchDBHandler_: Logs records to a CouchDB server.
+- _DoctrineCouchDBHandler_: Logs records to a CouchDB server via the Doctrine CouchDB ODM.
+- _ElasticSearchHandler_: Logs records to an Elastic Search server.
+- _DynamoDbHandler_: Logs records to a DynamoDB table with the [AWS SDK](https://github.com/aws/aws-sdk-php).
+
+### Wrappers / Special Handlers
+
+- _FingersCrossedHandler_: A very interesting wrapper. It takes a logger as
+ parameter and will accumulate log records of all levels until a record
+ exceeds the defined severity level. At which point it delivers all records,
+ including those of lower severity, to the handler it wraps. This means that
+ until an error actually happens you will not see anything in your logs, but
+ when it happens you will have the full information, including debug and info
+ records. This provides you with all the information you need, but only when
+ you need it.
+- _DeduplicationHandler_: Useful if you are sending notifications or emails
+ when critical errors occur. It takes a logger as parameter and will
+ accumulate log records of all levels until the end of the request (or
+ `flush()` is called). At that point it delivers all records to the handler
+ it wraps, but only if the records are unique over a given time period
+ (60seconds by default). If the records are duplicates they are simply
+ discarded. The main use of this is in case of critical failure like if your
+ database is unreachable for example all your requests will fail and that
+ can result in a lot of notifications being sent. Adding this handler reduces
+ the amount of notifications to a manageable level.
+- _WhatFailureGroupHandler_: This handler extends the _GroupHandler_ ignoring
+ exceptions raised by each child handler. This allows you to ignore issues
+ where a remote tcp connection may have died but you do not want your entire
+ application to crash and may wish to continue to log to other handlers.
+- _BufferHandler_: This handler will buffer all the log records it receives
+ until `close()` is called at which point it will call `handleBatch()` on the
+ handler it wraps with all the log messages at once. This is very useful to
+ send an email with all records at once for example instead of having one mail
+ for every log record.
+- _GroupHandler_: This handler groups other handlers. Every record received is
+ sent to all the handlers it is configured with.
+- _FilterHandler_: This handler only lets records of the given levels through
+ to the wrapped handler.
+- _SamplingHandler_: Wraps around another handler and lets you sample records
+ if you only want to store some of them.
+- _NullHandler_: Any record it can handle will be thrown away. This can be used
+ to put on top of an existing handler stack to disable it temporarily.
+- _PsrHandler_: Can be used to forward log records to an existing PSR-3 logger
+- _TestHandler_: Used for testing, it records everything that is sent to it and
+ has accessors to read out the information.
+- _HandlerWrapper_: A simple handler wrapper you can inherit from to create
+ your own wrappers easily.
+
+## Formatters
+
+- _LineFormatter_: Formats a log record into a one-line string.
+- _HtmlFormatter_: Used to format log records into a human readable html table, mainly suitable for emails.
+- _NormalizerFormatter_: Normalizes objects/resources down to strings so a record can easily be serialized/encoded.
+- _ScalarFormatter_: Used to format log records into an associative array of scalar values.
+- _JsonFormatter_: Encodes a log record into json.
+- _WildfireFormatter_: Used to format log records into the Wildfire/FirePHP protocol, only useful for the FirePHPHandler.
+- _ChromePHPFormatter_: Used to format log records into the ChromePHP format, only useful for the ChromePHPHandler.
+- _GelfMessageFormatter_: Used to format log records into Gelf message instances, only useful for the GelfHandler.
+- _LogstashFormatter_: Used to format log records into [logstash](http://logstash.net/) event json, useful for any handler listed under inputs [here](http://logstash.net/docs/latest).
+- _ElasticaFormatter_: Used to format log records into an Elastica\Document object, only useful for the ElasticSearchHandler.
+- _LogglyFormatter_: Used to format log records into Loggly messages, only useful for the LogglyHandler.
+- _FlowdockFormatter_: Used to format log records into Flowdock messages, only useful for the FlowdockHandler.
+- _MongoDBFormatter_: Converts \DateTime instances to \MongoDate and objects recursively to arrays, only useful with the MongoDBHandler.
+
+## Processors
+
+- _PsrLogMessageProcessor_: Processes a log record's message according to PSR-3 rules, replacing `{foo}` with the value from `$context['foo']`.
+- _IntrospectionProcessor_: Adds the line/file/class/method from which the log call originated.
+- _WebProcessor_: Adds the current request URI, request method and client IP to a log record.
+- _MemoryUsageProcessor_: Adds the current memory usage to a log record.
+- _MemoryPeakUsageProcessor_: Adds the peak memory usage to a log record.
+- _ProcessIdProcessor_: Adds the process id to a log record.
+- _UidProcessor_: Adds a unique identifier to a log record.
+- _GitProcessor_: Adds the current git branch and commit to a log record.
+- _TagProcessor_: Adds an array of predefined tags to a log record.
+
+## Third Party Packages
+
+Third party handlers, formatters and processors are
+[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You
+can also add your own there if you publish one.
+
+← [Usage](01-usage.md) | [Utility classes](03-utilities.md) →
diff --git a/vendor/monolog/monolog/doc/03-utilities.md b/vendor/monolog/monolog/doc/03-utilities.md
new file mode 100644
index 0000000..c62aa41
--- /dev/null
+++ b/vendor/monolog/monolog/doc/03-utilities.md
@@ -0,0 +1,13 @@
+# Utilities
+
+- _Registry_: The `Monolog\Registry` class lets you configure global loggers that you
+ can then statically access from anywhere. It is not really a best practice but can
+ help in some older codebases or for ease of use.
+- _ErrorHandler_: The `Monolog\ErrorHandler` class allows you to easily register
+ a Logger instance as an exception handler, error handler or fatal error handler.
+- _ErrorLevelActivationStrategy_: Activates a FingersCrossedHandler when a certain log
+ level is reached.
+- _ChannelLevelActivationStrategy_: Activates a FingersCrossedHandler when a certain
+ log level is reached, depending on which channel received the log record.
+
+← [Handlers, Formatters and Processors](02-handlers-formatters-processors.md) | [Extending Monolog](04-extending.md) →
diff --git a/vendor/monolog/monolog/doc/04-extending.md b/vendor/monolog/monolog/doc/04-extending.md
new file mode 100644
index 0000000..ebd9104
--- /dev/null
+++ b/vendor/monolog/monolog/doc/04-extending.md
@@ -0,0 +1,76 @@
+# Extending Monolog
+
+Monolog is fully extensible, allowing you to adapt your logger to your needs.
+
+## Writing your own handler
+
+Monolog provides many built-in handlers. But if the one you need does not
+exist, you can write it and use it in your logger. The only requirement is
+to implement `Monolog\Handler\HandlerInterface`.
+
+Let's write a PDOHandler to log records to a database. We will extend the
+abstract class provided by Monolog to keep things DRY.
+
+```php
+pdo = $pdo;
+ parent::__construct($level, $bubble);
+ }
+
+ protected function write(array $record)
+ {
+ if (!$this->initialized) {
+ $this->initialize();
+ }
+
+ $this->statement->execute(array(
+ 'channel' => $record['channel'],
+ 'level' => $record['level'],
+ 'message' => $record['formatted'],
+ 'time' => $record['datetime']->format('U'),
+ ));
+ }
+
+ private function initialize()
+ {
+ $this->pdo->exec(
+ 'CREATE TABLE IF NOT EXISTS monolog '
+ .'(channel VARCHAR(255), level INTEGER, message LONGTEXT, time INTEGER UNSIGNED)'
+ );
+ $this->statement = $this->pdo->prepare(
+ 'INSERT INTO monolog (channel, level, message, time) VALUES (:channel, :level, :message, :time)'
+ );
+
+ $this->initialized = true;
+ }
+}
+```
+
+You can now use this handler in your logger:
+
+```php
+pushHandler(new PDOHandler(new PDO('sqlite:logs.sqlite')));
+
+// You can now use your logger
+$logger->addInfo('My logger is now ready');
+```
+
+The `Monolog\Handler\AbstractProcessingHandler` class provides most of the
+logic needed for the handler, including the use of processors and the formatting
+of the record (which is why we use ``$record['formatted']`` instead of ``$record['message']``).
+
+← [Utility classes](03-utilities.md)
diff --git a/vendor/monolog/monolog/doc/sockets.md b/vendor/monolog/monolog/doc/sockets.md
new file mode 100644
index 0000000..ea9cf0e
--- /dev/null
+++ b/vendor/monolog/monolog/doc/sockets.md
@@ -0,0 +1,39 @@
+Sockets Handler
+===============
+
+This handler allows you to write your logs to sockets using [fsockopen](http://php.net/fsockopen)
+or [pfsockopen](http://php.net/pfsockopen).
+
+Persistent sockets are mainly useful in web environments where you gain some performance not closing/opening
+the connections between requests.
+
+You can use a `unix://` prefix to access unix sockets and `udp://` to open UDP sockets instead of the default TCP.
+
+Basic Example
+-------------
+
+```php
+setPersistent(true);
+
+// Now add the handler
+$logger->pushHandler($handler, Logger::DEBUG);
+
+// You can now use your logger
+$logger->addInfo('My logger is now ready');
+
+```
+
+In this example, using syslog-ng, you should see the log on the log server:
+
+ cweb1 [2012-02-26 00:12:03] my_logger.INFO: My logger is now ready [] []
+
diff --git a/vendor/monolog/monolog/phpunit.xml.dist b/vendor/monolog/monolog/phpunit.xml.dist
new file mode 100644
index 0000000..20d82b6
--- /dev/null
+++ b/vendor/monolog/monolog/phpunit.xml.dist
@@ -0,0 +1,19 @@
+
+
+
+
+
+ tests/Monolog/
+
+
+
+
+
+ src/Monolog/
+
+
+
+
+
+
+
diff --git a/vendor/monolog/monolog/src/Monolog/ErrorHandler.php b/vendor/monolog/monolog/src/Monolog/ErrorHandler.php
new file mode 100644
index 0000000..7bfcd83
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/ErrorHandler.php
@@ -0,0 +1,230 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog;
+
+use Psr\Log\LoggerInterface;
+use Psr\Log\LogLevel;
+use Monolog\Handler\AbstractHandler;
+
+/**
+ * Monolog error handler
+ *
+ * A facility to enable logging of runtime errors, exceptions and fatal errors.
+ *
+ * Quick setup: ErrorHandler::register($logger);
+ *
+ * @author Jordi Boggiano
+ */
+class ErrorHandler
+{
+ private $logger;
+
+ private $previousExceptionHandler;
+ private $uncaughtExceptionLevel;
+
+ private $previousErrorHandler;
+ private $errorLevelMap;
+ private $handleOnlyReportedErrors;
+
+ private $hasFatalErrorHandler;
+ private $fatalLevel;
+ private $reservedMemory;
+ private static $fatalErrors = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR);
+
+ public function __construct(LoggerInterface $logger)
+ {
+ $this->logger = $logger;
+ }
+
+ /**
+ * Registers a new ErrorHandler for a given Logger
+ *
+ * By default it will handle errors, exceptions and fatal errors
+ *
+ * @param LoggerInterface $logger
+ * @param array|false $errorLevelMap an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling
+ * @param int|false $exceptionLevel a LogLevel::* constant, or false to disable exception handling
+ * @param int|false $fatalLevel a LogLevel::* constant, or false to disable fatal error handling
+ * @return ErrorHandler
+ */
+ public static function register(LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null)
+ {
+ //Forces the autoloader to run for LogLevel. Fixes an autoload issue at compile-time on PHP5.3. See https://github.com/Seldaek/monolog/pull/929
+ class_exists('\\Psr\\Log\\LogLevel', true);
+
+ $handler = new static($logger);
+ if ($errorLevelMap !== false) {
+ $handler->registerErrorHandler($errorLevelMap);
+ }
+ if ($exceptionLevel !== false) {
+ $handler->registerExceptionHandler($exceptionLevel);
+ }
+ if ($fatalLevel !== false) {
+ $handler->registerFatalHandler($fatalLevel);
+ }
+
+ return $handler;
+ }
+
+ public function registerExceptionHandler($level = null, $callPrevious = true)
+ {
+ $prev = set_exception_handler(array($this, 'handleException'));
+ $this->uncaughtExceptionLevel = $level;
+ if ($callPrevious && $prev) {
+ $this->previousExceptionHandler = $prev;
+ }
+ }
+
+ public function registerErrorHandler(array $levelMap = array(), $callPrevious = true, $errorTypes = -1, $handleOnlyReportedErrors = true)
+ {
+ $prev = set_error_handler(array($this, 'handleError'), $errorTypes);
+ $this->errorLevelMap = array_replace($this->defaultErrorLevelMap(), $levelMap);
+ if ($callPrevious) {
+ $this->previousErrorHandler = $prev ?: true;
+ }
+
+ $this->handleOnlyReportedErrors = $handleOnlyReportedErrors;
+ }
+
+ public function registerFatalHandler($level = null, $reservedMemorySize = 20)
+ {
+ register_shutdown_function(array($this, 'handleFatalError'));
+
+ $this->reservedMemory = str_repeat(' ', 1024 * $reservedMemorySize);
+ $this->fatalLevel = $level;
+ $this->hasFatalErrorHandler = true;
+ }
+
+ protected function defaultErrorLevelMap()
+ {
+ return array(
+ E_ERROR => LogLevel::CRITICAL,
+ E_WARNING => LogLevel::WARNING,
+ E_PARSE => LogLevel::ALERT,
+ E_NOTICE => LogLevel::NOTICE,
+ E_CORE_ERROR => LogLevel::CRITICAL,
+ E_CORE_WARNING => LogLevel::WARNING,
+ E_COMPILE_ERROR => LogLevel::ALERT,
+ E_COMPILE_WARNING => LogLevel::WARNING,
+ E_USER_ERROR => LogLevel::ERROR,
+ E_USER_WARNING => LogLevel::WARNING,
+ E_USER_NOTICE => LogLevel::NOTICE,
+ E_STRICT => LogLevel::NOTICE,
+ E_RECOVERABLE_ERROR => LogLevel::ERROR,
+ E_DEPRECATED => LogLevel::NOTICE,
+ E_USER_DEPRECATED => LogLevel::NOTICE,
+ );
+ }
+
+ /**
+ * @private
+ */
+ public function handleException($e)
+ {
+ $this->logger->log(
+ $this->uncaughtExceptionLevel === null ? LogLevel::ERROR : $this->uncaughtExceptionLevel,
+ sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()),
+ array('exception' => $e)
+ );
+
+ if ($this->previousExceptionHandler) {
+ call_user_func($this->previousExceptionHandler, $e);
+ }
+
+ exit(255);
+ }
+
+ /**
+ * @private
+ */
+ public function handleError($code, $message, $file = '', $line = 0, $context = array())
+ {
+ if ($this->handleOnlyReportedErrors && !(error_reporting() & $code)) {
+ return;
+ }
+
+ // fatal error codes are ignored if a fatal error handler is present as well to avoid duplicate log entries
+ if (!$this->hasFatalErrorHandler || !in_array($code, self::$fatalErrors, true)) {
+ $level = isset($this->errorLevelMap[$code]) ? $this->errorLevelMap[$code] : LogLevel::CRITICAL;
+ $this->logger->log($level, self::codeToString($code).': '.$message, array('code' => $code, 'message' => $message, 'file' => $file, 'line' => $line));
+ }
+
+ if ($this->previousErrorHandler === true) {
+ return false;
+ } elseif ($this->previousErrorHandler) {
+ return call_user_func($this->previousErrorHandler, $code, $message, $file, $line, $context);
+ }
+ }
+
+ /**
+ * @private
+ */
+ public function handleFatalError()
+ {
+ $this->reservedMemory = null;
+
+ $lastError = error_get_last();
+ if ($lastError && in_array($lastError['type'], self::$fatalErrors, true)) {
+ $this->logger->log(
+ $this->fatalLevel === null ? LogLevel::ALERT : $this->fatalLevel,
+ 'Fatal Error ('.self::codeToString($lastError['type']).'): '.$lastError['message'],
+ array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line'])
+ );
+
+ if ($this->logger instanceof Logger) {
+ foreach ($this->logger->getHandlers() as $handler) {
+ if ($handler instanceof AbstractHandler) {
+ $handler->close();
+ }
+ }
+ }
+ }
+ }
+
+ private static function codeToString($code)
+ {
+ switch ($code) {
+ case E_ERROR:
+ return 'E_ERROR';
+ case E_WARNING:
+ return 'E_WARNING';
+ case E_PARSE:
+ return 'E_PARSE';
+ case E_NOTICE:
+ return 'E_NOTICE';
+ case E_CORE_ERROR:
+ return 'E_CORE_ERROR';
+ case E_CORE_WARNING:
+ return 'E_CORE_WARNING';
+ case E_COMPILE_ERROR:
+ return 'E_COMPILE_ERROR';
+ case E_COMPILE_WARNING:
+ return 'E_COMPILE_WARNING';
+ case E_USER_ERROR:
+ return 'E_USER_ERROR';
+ case E_USER_WARNING:
+ return 'E_USER_WARNING';
+ case E_USER_NOTICE:
+ return 'E_USER_NOTICE';
+ case E_STRICT:
+ return 'E_STRICT';
+ case E_RECOVERABLE_ERROR:
+ return 'E_RECOVERABLE_ERROR';
+ case E_DEPRECATED:
+ return 'E_DEPRECATED';
+ case E_USER_DEPRECATED:
+ return 'E_USER_DEPRECATED';
+ }
+
+ return 'Unknown PHP error';
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php
new file mode 100644
index 0000000..9beda1e
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php
@@ -0,0 +1,78 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+
+/**
+ * Formats a log message according to the ChromePHP array format
+ *
+ * @author Christophe Coevoet
+ */
+class ChromePHPFormatter implements FormatterInterface
+{
+ /**
+ * Translates Monolog log levels to Wildfire levels.
+ */
+ private $logLevels = array(
+ Logger::DEBUG => 'log',
+ Logger::INFO => 'info',
+ Logger::NOTICE => 'info',
+ Logger::WARNING => 'warn',
+ Logger::ERROR => 'error',
+ Logger::CRITICAL => 'error',
+ Logger::ALERT => 'error',
+ Logger::EMERGENCY => 'error',
+ );
+
+ /**
+ * {@inheritdoc}
+ */
+ public function format(array $record)
+ {
+ // Retrieve the line and file if set and remove them from the formatted extra
+ $backtrace = 'unknown';
+ if (isset($record['extra']['file'], $record['extra']['line'])) {
+ $backtrace = $record['extra']['file'].' : '.$record['extra']['line'];
+ unset($record['extra']['file'], $record['extra']['line']);
+ }
+
+ $message = array('message' => $record['message']);
+ if ($record['context']) {
+ $message['context'] = $record['context'];
+ }
+ if ($record['extra']) {
+ $message['extra'] = $record['extra'];
+ }
+ if (count($message) === 1) {
+ $message = reset($message);
+ }
+
+ return array(
+ $record['channel'],
+ $message,
+ $backtrace,
+ $this->logLevels[$record['level']],
+ );
+ }
+
+ public function formatBatch(array $records)
+ {
+ $formatted = array();
+
+ foreach ($records as $record) {
+ $formatted[] = $this->format($record);
+ }
+
+ return $formatted;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php
new file mode 100644
index 0000000..4c556cf
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php
@@ -0,0 +1,89 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Elastica\Document;
+
+/**
+ * Format a log message into an Elastica Document
+ *
+ * @author Jelle Vink
+ */
+class ElasticaFormatter extends NormalizerFormatter
+{
+ /**
+ * @var string Elastic search index name
+ */
+ protected $index;
+
+ /**
+ * @var string Elastic search document type
+ */
+ protected $type;
+
+ /**
+ * @param string $index Elastic Search index name
+ * @param string $type Elastic Search document type
+ */
+ public function __construct($index, $type)
+ {
+ // elasticsearch requires a ISO 8601 format date with optional millisecond precision.
+ parent::__construct('Y-m-d\TH:i:s.uP');
+
+ $this->index = $index;
+ $this->type = $type;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function format(array $record)
+ {
+ $record = parent::format($record);
+
+ return $this->getDocument($record);
+ }
+
+ /**
+ * Getter index
+ * @return string
+ */
+ public function getIndex()
+ {
+ return $this->index;
+ }
+
+ /**
+ * Getter type
+ * @return string
+ */
+ public function getType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * Convert a log message into an Elastica Document
+ *
+ * @param array $record Log message
+ * @return Document
+ */
+ protected function getDocument($record)
+ {
+ $document = new Document();
+ $document->setData($record);
+ $document->setType($this->type);
+ $document->setIndex($this->index);
+
+ return $document;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php
new file mode 100644
index 0000000..5094af3
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php
@@ -0,0 +1,116 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+/**
+ * formats the record to be used in the FlowdockHandler
+ *
+ * @author Dominik Liebler
+ */
+class FlowdockFormatter implements FormatterInterface
+{
+ /**
+ * @var string
+ */
+ private $source;
+
+ /**
+ * @var string
+ */
+ private $sourceEmail;
+
+ /**
+ * @param string $source
+ * @param string $sourceEmail
+ */
+ public function __construct($source, $sourceEmail)
+ {
+ $this->source = $source;
+ $this->sourceEmail = $sourceEmail;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function format(array $record)
+ {
+ $tags = array(
+ '#logs',
+ '#' . strtolower($record['level_name']),
+ '#' . $record['channel'],
+ );
+
+ foreach ($record['extra'] as $value) {
+ $tags[] = '#' . $value;
+ }
+
+ $subject = sprintf(
+ 'in %s: %s - %s',
+ $this->source,
+ $record['level_name'],
+ $this->getShortMessage($record['message'])
+ );
+
+ $record['flowdock'] = array(
+ 'source' => $this->source,
+ 'from_address' => $this->sourceEmail,
+ 'subject' => $subject,
+ 'content' => $record['message'],
+ 'tags' => $tags,
+ 'project' => $this->source,
+ );
+
+ return $record;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function formatBatch(array $records)
+ {
+ $formatted = array();
+
+ foreach ($records as $record) {
+ $formatted[] = $this->format($record);
+ }
+
+ return $formatted;
+ }
+
+ /**
+ * @param string $message
+ *
+ * @return string
+ */
+ public function getShortMessage($message)
+ {
+ static $hasMbString;
+
+ if (null === $hasMbString) {
+ $hasMbString = function_exists('mb_strlen');
+ }
+
+ $maxLength = 45;
+
+ if ($hasMbString) {
+ if (mb_strlen($message, 'UTF-8') > $maxLength) {
+ $message = mb_substr($message, 0, $maxLength - 4, 'UTF-8') . ' ...';
+ }
+ } else {
+ if (strlen($message) > $maxLength) {
+ $message = substr($message, 0, $maxLength - 4) . ' ...';
+ }
+ }
+
+ return $message;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php
new file mode 100644
index 0000000..02632bb
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php
@@ -0,0 +1,85 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+/**
+ * Class FluentdFormatter
+ *
+ * Serializes a log message to Fluentd unix socket protocol
+ *
+ * Fluentd config:
+ *
+ *
+ * type unix
+ * path /var/run/td-agent/td-agent.sock
+ *
+ *
+ * Monolog setup:
+ *
+ * $logger = new Monolog\Logger('fluent.tag');
+ * $fluentHandler = new Monolog\Handler\SocketHandler('unix:///var/run/td-agent/td-agent.sock');
+ * $fluentHandler->setFormatter(new Monolog\Formatter\FluentdFormatter());
+ * $logger->pushHandler($fluentHandler);
+ *
+ * @author Andrius Putna
+ */
+class FluentdFormatter implements FormatterInterface
+{
+ /**
+ * @var bool $levelTag should message level be a part of the fluentd tag
+ */
+ protected $levelTag = false;
+
+ public function __construct($levelTag = false)
+ {
+ if (!function_exists('json_encode')) {
+ throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter');
+ }
+
+ $this->levelTag = (bool) $levelTag;
+ }
+
+ public function isUsingLevelsInTag()
+ {
+ return $this->levelTag;
+ }
+
+ public function format(array $record)
+ {
+ $tag = $record['channel'];
+ if ($this->levelTag) {
+ $tag .= '.' . strtolower($record['level_name']);
+ }
+
+ $message = array(
+ 'message' => $record['message'],
+ 'extra' => $record['extra'],
+ );
+
+ if (!$this->levelTag) {
+ $message['level'] = $record['level'];
+ $message['level_name'] = $record['level_name'];
+ }
+
+ return json_encode(array($tag, $record['datetime']->getTimestamp(), $message));
+ }
+
+ public function formatBatch(array $records)
+ {
+ $message = '';
+ foreach ($records as $record) {
+ $message .= $this->format($record);
+ }
+
+ return $message;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php b/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php
new file mode 100644
index 0000000..b5de751
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php
@@ -0,0 +1,36 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+/**
+ * Interface for formatters
+ *
+ * @author Jordi Boggiano
+ */
+interface FormatterInterface
+{
+ /**
+ * Formats a log record.
+ *
+ * @param array $record A record to format
+ * @return mixed The formatted record
+ */
+ public function format(array $record);
+
+ /**
+ * Formats a set of log records.
+ *
+ * @param array $records A set of records to format
+ * @return mixed The formatted set of records
+ */
+ public function formatBatch(array $records);
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php
new file mode 100644
index 0000000..2c1b0e8
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php
@@ -0,0 +1,138 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+use Gelf\Message;
+
+/**
+ * Serializes a log message to GELF
+ * @see http://www.graylog2.org/about/gelf
+ *
+ * @author Matt Lehner
+ */
+class GelfMessageFormatter extends NormalizerFormatter
+{
+ const DEFAULT_MAX_LENGTH = 32766;
+
+ /**
+ * @var string the name of the system for the Gelf log message
+ */
+ protected $systemName;
+
+ /**
+ * @var string a prefix for 'extra' fields from the Monolog record (optional)
+ */
+ protected $extraPrefix;
+
+ /**
+ * @var string a prefix for 'context' fields from the Monolog record (optional)
+ */
+ protected $contextPrefix;
+
+ /**
+ * @var int max length per field
+ */
+ protected $maxLength;
+
+ /**
+ * Translates Monolog log levels to Graylog2 log priorities.
+ */
+ private $logLevels = array(
+ Logger::DEBUG => 7,
+ Logger::INFO => 6,
+ Logger::NOTICE => 5,
+ Logger::WARNING => 4,
+ Logger::ERROR => 3,
+ Logger::CRITICAL => 2,
+ Logger::ALERT => 1,
+ Logger::EMERGENCY => 0,
+ );
+
+ public function __construct($systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $maxLength = null)
+ {
+ parent::__construct('U.u');
+
+ $this->systemName = $systemName ?: gethostname();
+
+ $this->extraPrefix = $extraPrefix;
+ $this->contextPrefix = $contextPrefix;
+ $this->maxLength = is_null($maxLength) ? self::DEFAULT_MAX_LENGTH : $maxLength;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function format(array $record)
+ {
+ $record = parent::format($record);
+
+ if (!isset($record['datetime'], $record['message'], $record['level'])) {
+ throw new \InvalidArgumentException('The record should at least contain datetime, message and level keys, '.var_export($record, true).' given');
+ }
+
+ $message = new Message();
+ $message
+ ->setTimestamp($record['datetime'])
+ ->setShortMessage((string) $record['message'])
+ ->setHost($this->systemName)
+ ->setLevel($this->logLevels[$record['level']]);
+
+ // message length + system name length + 200 for padding / metadata
+ $len = 200 + strlen((string) $record['message']) + strlen($this->systemName);
+
+ if ($len > $this->maxLength) {
+ $message->setShortMessage(substr($record['message'], 0, $this->maxLength));
+ }
+
+ if (isset($record['channel'])) {
+ $message->setFacility($record['channel']);
+ }
+ if (isset($record['extra']['line'])) {
+ $message->setLine($record['extra']['line']);
+ unset($record['extra']['line']);
+ }
+ if (isset($record['extra']['file'])) {
+ $message->setFile($record['extra']['file']);
+ unset($record['extra']['file']);
+ }
+
+ foreach ($record['extra'] as $key => $val) {
+ $val = is_scalar($val) || null === $val ? $val : $this->toJson($val);
+ $len = strlen($this->extraPrefix . $key . $val);
+ if ($len > $this->maxLength) {
+ $message->setAdditional($this->extraPrefix . $key, substr($val, 0, $this->maxLength));
+ break;
+ }
+ $message->setAdditional($this->extraPrefix . $key, $val);
+ }
+
+ foreach ($record['context'] as $key => $val) {
+ $val = is_scalar($val) || null === $val ? $val : $this->toJson($val);
+ $len = strlen($this->contextPrefix . $key . $val);
+ if ($len > $this->maxLength) {
+ $message->setAdditional($this->contextPrefix . $key, substr($val, 0, $this->maxLength));
+ break;
+ }
+ $message->setAdditional($this->contextPrefix . $key, $val);
+ }
+
+ if (null === $message->getFile() && isset($record['context']['exception']['file'])) {
+ if (preg_match("/^(.+):([0-9]+)$/", $record['context']['exception']['file'], $matches)) {
+ $message->setFile($matches[1]);
+ $message->setLine($matches[2]);
+ }
+ }
+
+ return $message;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php
new file mode 100644
index 0000000..3eec95f
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php
@@ -0,0 +1,141 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+
+/**
+ * Formats incoming records into an HTML table
+ *
+ * This is especially useful for html email logging
+ *
+ * @author Tiago Brito
+ */
+class HtmlFormatter extends NormalizerFormatter
+{
+ /**
+ * Translates Monolog log levels to html color priorities.
+ */
+ protected $logLevels = array(
+ Logger::DEBUG => '#cccccc',
+ Logger::INFO => '#468847',
+ Logger::NOTICE => '#3a87ad',
+ Logger::WARNING => '#c09853',
+ Logger::ERROR => '#f0ad4e',
+ Logger::CRITICAL => '#FF7708',
+ Logger::ALERT => '#C12A19',
+ Logger::EMERGENCY => '#000000',
+ );
+
+ /**
+ * @param string $dateFormat The format of the timestamp: one supported by DateTime::format
+ */
+ public function __construct($dateFormat = null)
+ {
+ parent::__construct($dateFormat);
+ }
+
+ /**
+ * Creates an HTML table row
+ *
+ * @param string $th Row header content
+ * @param string $td Row standard cell content
+ * @param bool $escapeTd false if td content must not be html escaped
+ * @return string
+ */
+ protected function addRow($th, $td = ' ', $escapeTd = true)
+ {
+ $th = htmlspecialchars($th, ENT_NOQUOTES, 'UTF-8');
+ if ($escapeTd) {
+ $td = ''.htmlspecialchars($td, ENT_NOQUOTES, 'UTF-8').'
';
+ }
+
+ return "\n$th: \n".$td." \n ";
+ }
+
+ /**
+ * Create a HTML h1 tag
+ *
+ * @param string $title Text to be in the h1
+ * @param int $level Error level
+ * @return string
+ */
+ protected function addTitle($title, $level)
+ {
+ $title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8');
+
+ return ''.$title.'
';
+ }
+
+ /**
+ * Formats a log record.
+ *
+ * @param array $record A record to format
+ * @return mixed The formatted record
+ */
+ public function format(array $record)
+ {
+ $output = $this->addTitle($record['level_name'], $record['level']);
+ $output .= '';
+
+ $output .= $this->addRow('Message', (string) $record['message']);
+ $output .= $this->addRow('Time', $record['datetime']->format($this->dateFormat));
+ $output .= $this->addRow('Channel', $record['channel']);
+ if ($record['context']) {
+ $embeddedTable = '';
+ foreach ($record['context'] as $key => $value) {
+ $embeddedTable .= $this->addRow($key, $this->convertToString($value));
+ }
+ $embeddedTable .= '
';
+ $output .= $this->addRow('Context', $embeddedTable, false);
+ }
+ if ($record['extra']) {
+ $embeddedTable = '';
+ foreach ($record['extra'] as $key => $value) {
+ $embeddedTable .= $this->addRow($key, $this->convertToString($value));
+ }
+ $embeddedTable .= '
';
+ $output .= $this->addRow('Extra', $embeddedTable, false);
+ }
+
+ return $output.'
';
+ }
+
+ /**
+ * Formats a set of log records.
+ *
+ * @param array $records A set of records to format
+ * @return mixed The formatted set of records
+ */
+ public function formatBatch(array $records)
+ {
+ $message = '';
+ foreach ($records as $record) {
+ $message .= $this->format($record);
+ }
+
+ return $message;
+ }
+
+ protected function convertToString($data)
+ {
+ if (null === $data || is_scalar($data)) {
+ return (string) $data;
+ }
+
+ $data = $this->normalize($data);
+ if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
+ return json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
+ }
+
+ return str_replace('\\/', '/', json_encode($data));
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php
new file mode 100644
index 0000000..0782f14
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php
@@ -0,0 +1,208 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Exception;
+use Throwable;
+
+/**
+ * Encodes whatever record data is passed to it as json
+ *
+ * This can be useful to log to databases or remote APIs
+ *
+ * @author Jordi Boggiano
+ */
+class JsonFormatter extends NormalizerFormatter
+{
+ const BATCH_MODE_JSON = 1;
+ const BATCH_MODE_NEWLINES = 2;
+
+ protected $batchMode;
+ protected $appendNewline;
+
+ /**
+ * @var bool
+ */
+ protected $includeStacktraces = false;
+
+ /**
+ * @param int $batchMode
+ * @param bool $appendNewline
+ */
+ public function __construct($batchMode = self::BATCH_MODE_JSON, $appendNewline = true)
+ {
+ $this->batchMode = $batchMode;
+ $this->appendNewline = $appendNewline;
+ }
+
+ /**
+ * The batch mode option configures the formatting style for
+ * multiple records. By default, multiple records will be
+ * formatted as a JSON-encoded array. However, for
+ * compatibility with some API endpoints, alternative styles
+ * are available.
+ *
+ * @return int
+ */
+ public function getBatchMode()
+ {
+ return $this->batchMode;
+ }
+
+ /**
+ * True if newlines are appended to every formatted record
+ *
+ * @return bool
+ */
+ public function isAppendingNewlines()
+ {
+ return $this->appendNewline;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function format(array $record)
+ {
+ return $this->toJson($this->normalize($record), true) . ($this->appendNewline ? "\n" : '');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function formatBatch(array $records)
+ {
+ switch ($this->batchMode) {
+ case static::BATCH_MODE_NEWLINES:
+ return $this->formatBatchNewlines($records);
+
+ case static::BATCH_MODE_JSON:
+ default:
+ return $this->formatBatchJson($records);
+ }
+ }
+
+ /**
+ * @param bool $include
+ */
+ public function includeStacktraces($include = true)
+ {
+ $this->includeStacktraces = $include;
+ }
+
+ /**
+ * Return a JSON-encoded array of records.
+ *
+ * @param array $records
+ * @return string
+ */
+ protected function formatBatchJson(array $records)
+ {
+ return $this->toJson($this->normalize($records), true);
+ }
+
+ /**
+ * Use new lines to separate records instead of a
+ * JSON-encoded array.
+ *
+ * @param array $records
+ * @return string
+ */
+ protected function formatBatchNewlines(array $records)
+ {
+ $instance = $this;
+
+ $oldNewline = $this->appendNewline;
+ $this->appendNewline = false;
+ array_walk($records, function (&$value, $key) use ($instance) {
+ $value = $instance->format($value);
+ });
+ $this->appendNewline = $oldNewline;
+
+ return implode("\n", $records);
+ }
+
+ /**
+ * Normalizes given $data.
+ *
+ * @param mixed $data
+ *
+ * @return mixed
+ */
+ protected function normalize($data)
+ {
+ if (is_array($data) || $data instanceof \Traversable) {
+ $normalized = array();
+
+ $count = 1;
+ foreach ($data as $key => $value) {
+ if ($count++ >= 1000) {
+ $normalized['...'] = 'Over 1000 items, aborting normalization';
+ break;
+ }
+ $normalized[$key] = $this->normalize($value);
+ }
+
+ return $normalized;
+ }
+
+ if ($data instanceof Exception || $data instanceof Throwable) {
+ return $this->normalizeException($data);
+ }
+
+ return $data;
+ }
+
+ /**
+ * Normalizes given exception with or without its own stack trace based on
+ * `includeStacktraces` property.
+ *
+ * @param Exception|Throwable $e
+ *
+ * @return array
+ */
+ protected function normalizeException($e)
+ {
+ // TODO 2.0 only check for Throwable
+ if (!$e instanceof Exception && !$e instanceof Throwable) {
+ throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e));
+ }
+
+ $data = array(
+ 'class' => get_class($e),
+ 'message' => $e->getMessage(),
+ 'code' => $e->getCode(),
+ 'file' => $e->getFile().':'.$e->getLine(),
+ );
+
+ if ($this->includeStacktraces) {
+ $trace = $e->getTrace();
+ foreach ($trace as $frame) {
+ if (isset($frame['file'])) {
+ $data['trace'][] = $frame['file'].':'.$frame['line'];
+ } elseif (isset($frame['function']) && $frame['function'] === '{closure}') {
+ // We should again normalize the frames, because it might contain invalid items
+ $data['trace'][] = $frame['function'];
+ } else {
+ // We should again normalize the frames, because it might contain invalid items
+ $data['trace'][] = $this->normalize($frame);
+ }
+ }
+ }
+
+ if ($previous = $e->getPrevious()) {
+ $data['previous'] = $this->normalizeException($previous);
+ }
+
+ return $data;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php
new file mode 100644
index 0000000..d3e209e
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php
@@ -0,0 +1,179 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+/**
+ * Formats incoming records into a one-line string
+ *
+ * This is especially useful for logging to files
+ *
+ * @author Jordi Boggiano
+ * @author Christophe Coevoet
+ */
+class LineFormatter extends NormalizerFormatter
+{
+ const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";
+
+ protected $format;
+ protected $allowInlineLineBreaks;
+ protected $ignoreEmptyContextAndExtra;
+ protected $includeStacktraces;
+
+ /**
+ * @param string $format The format of the message
+ * @param string $dateFormat The format of the timestamp: one supported by DateTime::format
+ * @param bool $allowInlineLineBreaks Whether to allow inline line breaks in log entries
+ * @param bool $ignoreEmptyContextAndExtra
+ */
+ public function __construct($format = null, $dateFormat = null, $allowInlineLineBreaks = false, $ignoreEmptyContextAndExtra = false)
+ {
+ $this->format = $format ?: static::SIMPLE_FORMAT;
+ $this->allowInlineLineBreaks = $allowInlineLineBreaks;
+ $this->ignoreEmptyContextAndExtra = $ignoreEmptyContextAndExtra;
+ parent::__construct($dateFormat);
+ }
+
+ public function includeStacktraces($include = true)
+ {
+ $this->includeStacktraces = $include;
+ if ($this->includeStacktraces) {
+ $this->allowInlineLineBreaks = true;
+ }
+ }
+
+ public function allowInlineLineBreaks($allow = true)
+ {
+ $this->allowInlineLineBreaks = $allow;
+ }
+
+ public function ignoreEmptyContextAndExtra($ignore = true)
+ {
+ $this->ignoreEmptyContextAndExtra = $ignore;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function format(array $record)
+ {
+ $vars = parent::format($record);
+
+ $output = $this->format;
+
+ foreach ($vars['extra'] as $var => $val) {
+ if (false !== strpos($output, '%extra.'.$var.'%')) {
+ $output = str_replace('%extra.'.$var.'%', $this->stringify($val), $output);
+ unset($vars['extra'][$var]);
+ }
+ }
+
+
+ foreach ($vars['context'] as $var => $val) {
+ if (false !== strpos($output, '%context.'.$var.'%')) {
+ $output = str_replace('%context.'.$var.'%', $this->stringify($val), $output);
+ unset($vars['context'][$var]);
+ }
+ }
+
+ if ($this->ignoreEmptyContextAndExtra) {
+ if (empty($vars['context'])) {
+ unset($vars['context']);
+ $output = str_replace('%context%', '', $output);
+ }
+
+ if (empty($vars['extra'])) {
+ unset($vars['extra']);
+ $output = str_replace('%extra%', '', $output);
+ }
+ }
+
+ foreach ($vars as $var => $val) {
+ if (false !== strpos($output, '%'.$var.'%')) {
+ $output = str_replace('%'.$var.'%', $this->stringify($val), $output);
+ }
+ }
+
+ // remove leftover %extra.xxx% and %context.xxx% if any
+ if (false !== strpos($output, '%')) {
+ $output = preg_replace('/%(?:extra|context)\..+?%/', '', $output);
+ }
+
+ return $output;
+ }
+
+ public function formatBatch(array $records)
+ {
+ $message = '';
+ foreach ($records as $record) {
+ $message .= $this->format($record);
+ }
+
+ return $message;
+ }
+
+ public function stringify($value)
+ {
+ return $this->replaceNewlines($this->convertToString($value));
+ }
+
+ protected function normalizeException($e)
+ {
+ // TODO 2.0 only check for Throwable
+ if (!$e instanceof \Exception && !$e instanceof \Throwable) {
+ throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e));
+ }
+
+ $previousText = '';
+ if ($previous = $e->getPrevious()) {
+ do {
+ $previousText .= ', '.get_class($previous).'(code: '.$previous->getCode().'): '.$previous->getMessage().' at '.$previous->getFile().':'.$previous->getLine();
+ } while ($previous = $previous->getPrevious());
+ }
+
+ $str = '[object] ('.get_class($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')';
+ if ($this->includeStacktraces) {
+ $str .= "\n[stacktrace]\n".$e->getTraceAsString()."\n";
+ }
+
+ return $str;
+ }
+
+ protected function convertToString($data)
+ {
+ if (null === $data || is_bool($data)) {
+ return var_export($data, true);
+ }
+
+ if (is_scalar($data)) {
+ return (string) $data;
+ }
+
+ if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
+ return $this->toJson($data, true);
+ }
+
+ return str_replace('\\/', '/', @json_encode($data));
+ }
+
+ protected function replaceNewlines($str)
+ {
+ if ($this->allowInlineLineBreaks) {
+ if (0 === strpos($str, '{')) {
+ return str_replace(array('\r', '\n'), array("\r", "\n"), $str);
+ }
+
+ return $str;
+ }
+
+ return str_replace(array("\r\n", "\r", "\n"), ' ', $str);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php
new file mode 100644
index 0000000..401859b
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php
@@ -0,0 +1,47 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+/**
+ * Encodes message information into JSON in a format compatible with Loggly.
+ *
+ * @author Adam Pancutt
+ */
+class LogglyFormatter extends JsonFormatter
+{
+ /**
+ * Overrides the default batch mode to new lines for compatibility with the
+ * Loggly bulk API.
+ *
+ * @param int $batchMode
+ */
+ public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false)
+ {
+ parent::__construct($batchMode, $appendNewline);
+ }
+
+ /**
+ * Appends the 'timestamp' parameter for indexing by Loggly.
+ *
+ * @see https://www.loggly.com/docs/automated-parsing/#json
+ * @see \Monolog\Formatter\JsonFormatter::format()
+ */
+ public function format(array $record)
+ {
+ if (isset($record["datetime"]) && ($record["datetime"] instanceof \DateTime)) {
+ $record["timestamp"] = $record["datetime"]->format("Y-m-d\TH:i:s.uO");
+ // TODO 2.0 unset the 'datetime' parameter, retained for BC
+ }
+
+ return parent::format($record);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php
new file mode 100644
index 0000000..8f83bec
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php
@@ -0,0 +1,166 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+/**
+ * Serializes a log message to Logstash Event Format
+ *
+ * @see http://logstash.net/
+ * @see https://github.com/logstash/logstash/blob/master/lib/logstash/event.rb
+ *
+ * @author Tim Mower
+ */
+class LogstashFormatter extends NormalizerFormatter
+{
+ const V0 = 0;
+ const V1 = 1;
+
+ /**
+ * @var string the name of the system for the Logstash log message, used to fill the @source field
+ */
+ protected $systemName;
+
+ /**
+ * @var string an application name for the Logstash log message, used to fill the @type field
+ */
+ protected $applicationName;
+
+ /**
+ * @var string a prefix for 'extra' fields from the Monolog record (optional)
+ */
+ protected $extraPrefix;
+
+ /**
+ * @var string a prefix for 'context' fields from the Monolog record (optional)
+ */
+ protected $contextPrefix;
+
+ /**
+ * @var int logstash format version to use
+ */
+ protected $version;
+
+ /**
+ * @param string $applicationName the application that sends the data, used as the "type" field of logstash
+ * @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine
+ * @param string $extraPrefix prefix for extra keys inside logstash "fields"
+ * @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_
+ * @param int $version the logstash format version to use, defaults to 0
+ */
+ public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0)
+ {
+ // logstash requires a ISO 8601 format date with optional millisecond precision.
+ parent::__construct('Y-m-d\TH:i:s.uP');
+
+ $this->systemName = $systemName ?: gethostname();
+ $this->applicationName = $applicationName;
+ $this->extraPrefix = $extraPrefix;
+ $this->contextPrefix = $contextPrefix;
+ $this->version = $version;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function format(array $record)
+ {
+ $record = parent::format($record);
+
+ if ($this->version === self::V1) {
+ $message = $this->formatV1($record);
+ } else {
+ $message = $this->formatV0($record);
+ }
+
+ return $this->toJson($message) . "\n";
+ }
+
+ protected function formatV0(array $record)
+ {
+ if (empty($record['datetime'])) {
+ $record['datetime'] = gmdate('c');
+ }
+ $message = array(
+ '@timestamp' => $record['datetime'],
+ '@source' => $this->systemName,
+ '@fields' => array(),
+ );
+ if (isset($record['message'])) {
+ $message['@message'] = $record['message'];
+ }
+ if (isset($record['channel'])) {
+ $message['@tags'] = array($record['channel']);
+ $message['@fields']['channel'] = $record['channel'];
+ }
+ if (isset($record['level'])) {
+ $message['@fields']['level'] = $record['level'];
+ }
+ if ($this->applicationName) {
+ $message['@type'] = $this->applicationName;
+ }
+ if (isset($record['extra']['server'])) {
+ $message['@source_host'] = $record['extra']['server'];
+ }
+ if (isset($record['extra']['url'])) {
+ $message['@source_path'] = $record['extra']['url'];
+ }
+ if (!empty($record['extra'])) {
+ foreach ($record['extra'] as $key => $val) {
+ $message['@fields'][$this->extraPrefix . $key] = $val;
+ }
+ }
+ if (!empty($record['context'])) {
+ foreach ($record['context'] as $key => $val) {
+ $message['@fields'][$this->contextPrefix . $key] = $val;
+ }
+ }
+
+ return $message;
+ }
+
+ protected function formatV1(array $record)
+ {
+ if (empty($record['datetime'])) {
+ $record['datetime'] = gmdate('c');
+ }
+ $message = array(
+ '@timestamp' => $record['datetime'],
+ '@version' => 1,
+ 'host' => $this->systemName,
+ );
+ if (isset($record['message'])) {
+ $message['message'] = $record['message'];
+ }
+ if (isset($record['channel'])) {
+ $message['type'] = $record['channel'];
+ $message['channel'] = $record['channel'];
+ }
+ if (isset($record['level_name'])) {
+ $message['level'] = $record['level_name'];
+ }
+ if ($this->applicationName) {
+ $message['type'] = $this->applicationName;
+ }
+ if (!empty($record['extra'])) {
+ foreach ($record['extra'] as $key => $val) {
+ $message[$this->extraPrefix . $key] = $val;
+ }
+ }
+ if (!empty($record['context'])) {
+ foreach ($record['context'] as $key => $val) {
+ $message[$this->contextPrefix . $key] = $val;
+ }
+ }
+
+ return $message;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php
new file mode 100644
index 0000000..eb067bb
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php
@@ -0,0 +1,105 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+/**
+ * Formats a record for use with the MongoDBHandler.
+ *
+ * @author Florian Plattner
+ */
+class MongoDBFormatter implements FormatterInterface
+{
+ private $exceptionTraceAsString;
+ private $maxNestingLevel;
+
+ /**
+ * @param int $maxNestingLevel 0 means infinite nesting, the $record itself is level 1, $record['context'] is 2
+ * @param bool $exceptionTraceAsString set to false to log exception traces as a sub documents instead of strings
+ */
+ public function __construct($maxNestingLevel = 3, $exceptionTraceAsString = true)
+ {
+ $this->maxNestingLevel = max($maxNestingLevel, 0);
+ $this->exceptionTraceAsString = (bool) $exceptionTraceAsString;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function format(array $record)
+ {
+ return $this->formatArray($record);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function formatBatch(array $records)
+ {
+ foreach ($records as $key => $record) {
+ $records[$key] = $this->format($record);
+ }
+
+ return $records;
+ }
+
+ protected function formatArray(array $record, $nestingLevel = 0)
+ {
+ if ($this->maxNestingLevel == 0 || $nestingLevel <= $this->maxNestingLevel) {
+ foreach ($record as $name => $value) {
+ if ($value instanceof \DateTime) {
+ $record[$name] = $this->formatDate($value, $nestingLevel + 1);
+ } elseif ($value instanceof \Exception) {
+ $record[$name] = $this->formatException($value, $nestingLevel + 1);
+ } elseif (is_array($value)) {
+ $record[$name] = $this->formatArray($value, $nestingLevel + 1);
+ } elseif (is_object($value)) {
+ $record[$name] = $this->formatObject($value, $nestingLevel + 1);
+ }
+ }
+ } else {
+ $record = '[...]';
+ }
+
+ return $record;
+ }
+
+ protected function formatObject($value, $nestingLevel)
+ {
+ $objectVars = get_object_vars($value);
+ $objectVars['class'] = get_class($value);
+
+ return $this->formatArray($objectVars, $nestingLevel);
+ }
+
+ protected function formatException(\Exception $exception, $nestingLevel)
+ {
+ $formattedException = array(
+ 'class' => get_class($exception),
+ 'message' => $exception->getMessage(),
+ 'code' => $exception->getCode(),
+ 'file' => $exception->getFile() . ':' . $exception->getLine(),
+ );
+
+ if ($this->exceptionTraceAsString === true) {
+ $formattedException['trace'] = $exception->getTraceAsString();
+ } else {
+ $formattedException['trace'] = $exception->getTrace();
+ }
+
+ return $this->formatArray($formattedException, $nestingLevel);
+ }
+
+ protected function formatDate(\DateTime $value, $nestingLevel)
+ {
+ return new \MongoDate($value->getTimestamp());
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php
new file mode 100644
index 0000000..d441488
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php
@@ -0,0 +1,297 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Exception;
+
+/**
+ * Normalizes incoming records to remove objects/resources so it's easier to dump to various targets
+ *
+ * @author Jordi Boggiano
+ */
+class NormalizerFormatter implements FormatterInterface
+{
+ const SIMPLE_DATE = "Y-m-d H:i:s";
+
+ protected $dateFormat;
+
+ /**
+ * @param string $dateFormat The format of the timestamp: one supported by DateTime::format
+ */
+ public function __construct($dateFormat = null)
+ {
+ $this->dateFormat = $dateFormat ?: static::SIMPLE_DATE;
+ if (!function_exists('json_encode')) {
+ throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s NormalizerFormatter');
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function format(array $record)
+ {
+ return $this->normalize($record);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function formatBatch(array $records)
+ {
+ foreach ($records as $key => $record) {
+ $records[$key] = $this->format($record);
+ }
+
+ return $records;
+ }
+
+ protected function normalize($data)
+ {
+ if (null === $data || is_scalar($data)) {
+ if (is_float($data)) {
+ if (is_infinite($data)) {
+ return ($data > 0 ? '' : '-') . 'INF';
+ }
+ if (is_nan($data)) {
+ return 'NaN';
+ }
+ }
+
+ return $data;
+ }
+
+ if (is_array($data)) {
+ $normalized = array();
+
+ $count = 1;
+ foreach ($data as $key => $value) {
+ if ($count++ >= 1000) {
+ $normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization';
+ break;
+ }
+ $normalized[$key] = $this->normalize($value);
+ }
+
+ return $normalized;
+ }
+
+ if ($data instanceof \DateTime) {
+ return $data->format($this->dateFormat);
+ }
+
+ if (is_object($data)) {
+ // TODO 2.0 only check for Throwable
+ if ($data instanceof Exception || (PHP_VERSION_ID > 70000 && $data instanceof \Throwable)) {
+ return $this->normalizeException($data);
+ }
+
+ // non-serializable objects that implement __toString stringified
+ if (method_exists($data, '__toString') && !$data instanceof \JsonSerializable) {
+ $value = $data->__toString();
+ } else {
+ // the rest is json-serialized in some way
+ $value = $this->toJson($data, true);
+ }
+
+ return sprintf("[object] (%s: %s)", get_class($data), $value);
+ }
+
+ if (is_resource($data)) {
+ return sprintf('[resource] (%s)', get_resource_type($data));
+ }
+
+ return '[unknown('.gettype($data).')]';
+ }
+
+ protected function normalizeException($e)
+ {
+ // TODO 2.0 only check for Throwable
+ if (!$e instanceof Exception && !$e instanceof \Throwable) {
+ throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e));
+ }
+
+ $data = array(
+ 'class' => get_class($e),
+ 'message' => $e->getMessage(),
+ 'code' => $e->getCode(),
+ 'file' => $e->getFile().':'.$e->getLine(),
+ );
+
+ if ($e instanceof \SoapFault) {
+ if (isset($e->faultcode)) {
+ $data['faultcode'] = $e->faultcode;
+ }
+
+ if (isset($e->faultactor)) {
+ $data['faultactor'] = $e->faultactor;
+ }
+
+ if (isset($e->detail)) {
+ $data['detail'] = $e->detail;
+ }
+ }
+
+ $trace = $e->getTrace();
+ foreach ($trace as $frame) {
+ if (isset($frame['file'])) {
+ $data['trace'][] = $frame['file'].':'.$frame['line'];
+ } elseif (isset($frame['function']) && $frame['function'] === '{closure}') {
+ // We should again normalize the frames, because it might contain invalid items
+ $data['trace'][] = $frame['function'];
+ } else {
+ // We should again normalize the frames, because it might contain invalid items
+ $data['trace'][] = $this->toJson($this->normalize($frame), true);
+ }
+ }
+
+ if ($previous = $e->getPrevious()) {
+ $data['previous'] = $this->normalizeException($previous);
+ }
+
+ return $data;
+ }
+
+ /**
+ * Return the JSON representation of a value
+ *
+ * @param mixed $data
+ * @param bool $ignoreErrors
+ * @throws \RuntimeException if encoding fails and errors are not ignored
+ * @return string
+ */
+ protected function toJson($data, $ignoreErrors = false)
+ {
+ // suppress json_encode errors since it's twitchy with some inputs
+ if ($ignoreErrors) {
+ return @$this->jsonEncode($data);
+ }
+
+ $json = $this->jsonEncode($data);
+
+ if ($json === false) {
+ $json = $this->handleJsonError(json_last_error(), $data);
+ }
+
+ return $json;
+ }
+
+ /**
+ * @param mixed $data
+ * @return string JSON encoded data or null on failure
+ */
+ private function jsonEncode($data)
+ {
+ if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
+ return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
+ }
+
+ return json_encode($data);
+ }
+
+ /**
+ * Handle a json_encode failure.
+ *
+ * If the failure is due to invalid string encoding, try to clean the
+ * input and encode again. If the second encoding attempt fails, the
+ * inital error is not encoding related or the input can't be cleaned then
+ * raise a descriptive exception.
+ *
+ * @param int $code return code of json_last_error function
+ * @param mixed $data data that was meant to be encoded
+ * @throws \RuntimeException if failure can't be corrected
+ * @return string JSON encoded data after error correction
+ */
+ private function handleJsonError($code, $data)
+ {
+ if ($code !== JSON_ERROR_UTF8) {
+ $this->throwEncodeError($code, $data);
+ }
+
+ if (is_string($data)) {
+ $this->detectAndCleanUtf8($data);
+ } elseif (is_array($data)) {
+ array_walk_recursive($data, array($this, 'detectAndCleanUtf8'));
+ } else {
+ $this->throwEncodeError($code, $data);
+ }
+
+ $json = $this->jsonEncode($data);
+
+ if ($json === false) {
+ $this->throwEncodeError(json_last_error(), $data);
+ }
+
+ return $json;
+ }
+
+ /**
+ * Throws an exception according to a given code with a customized message
+ *
+ * @param int $code return code of json_last_error function
+ * @param mixed $data data that was meant to be encoded
+ * @throws \RuntimeException
+ */
+ private function throwEncodeError($code, $data)
+ {
+ switch ($code) {
+ case JSON_ERROR_DEPTH:
+ $msg = 'Maximum stack depth exceeded';
+ break;
+ case JSON_ERROR_STATE_MISMATCH:
+ $msg = 'Underflow or the modes mismatch';
+ break;
+ case JSON_ERROR_CTRL_CHAR:
+ $msg = 'Unexpected control character found';
+ break;
+ case JSON_ERROR_UTF8:
+ $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
+ break;
+ default:
+ $msg = 'Unknown error';
+ }
+
+ throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true));
+ }
+
+ /**
+ * Detect invalid UTF-8 string characters and convert to valid UTF-8.
+ *
+ * Valid UTF-8 input will be left unmodified, but strings containing
+ * invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed
+ * original encoding of ISO-8859-15. This conversion may result in
+ * incorrect output if the actual encoding was not ISO-8859-15, but it
+ * will be clean UTF-8 output and will not rely on expensive and fragile
+ * detection algorithms.
+ *
+ * Function converts the input in place in the passed variable so that it
+ * can be used as a callback for array_walk_recursive.
+ *
+ * @param mixed &$data Input to check and convert if needed
+ * @private
+ */
+ public function detectAndCleanUtf8(&$data)
+ {
+ if (is_string($data) && !preg_match('//u', $data)) {
+ $data = preg_replace_callback(
+ '/[\x80-\xFF]+/',
+ function ($m) { return utf8_encode($m[0]); },
+ $data
+ );
+ $data = str_replace(
+ array('¤', '¦', '¨', '´', '¸', '¼', '½', '¾'),
+ array('€', 'Š', 'š', 'Ž', 'ž', 'Œ', 'œ', 'Ÿ'),
+ $data
+ );
+ }
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php
new file mode 100644
index 0000000..5d345d5
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php
@@ -0,0 +1,48 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+/**
+ * Formats data into an associative array of scalar values.
+ * Objects and arrays will be JSON encoded.
+ *
+ * @author Andrew Lawson
+ */
+class ScalarFormatter extends NormalizerFormatter
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function format(array $record)
+ {
+ foreach ($record as $key => $value) {
+ $record[$key] = $this->normalizeValue($value);
+ }
+
+ return $record;
+ }
+
+ /**
+ * @param mixed $value
+ * @return mixed
+ */
+ protected function normalizeValue($value)
+ {
+ $normalized = $this->normalize($value);
+
+ if (is_array($normalized) || is_object($normalized)) {
+ return $this->toJson($normalized, true);
+ }
+
+ return $normalized;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php b/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php
new file mode 100644
index 0000000..654710a
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php
@@ -0,0 +1,113 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+
+/**
+ * Serializes a log message according to Wildfire's header requirements
+ *
+ * @author Eric Clemmons (@ericclemmons)
+ * @author Christophe Coevoet
+ * @author Kirill chEbba Chebunin
+ */
+class WildfireFormatter extends NormalizerFormatter
+{
+ const TABLE = 'table';
+
+ /**
+ * Translates Monolog log levels to Wildfire levels.
+ */
+ private $logLevels = array(
+ Logger::DEBUG => 'LOG',
+ Logger::INFO => 'INFO',
+ Logger::NOTICE => 'INFO',
+ Logger::WARNING => 'WARN',
+ Logger::ERROR => 'ERROR',
+ Logger::CRITICAL => 'ERROR',
+ Logger::ALERT => 'ERROR',
+ Logger::EMERGENCY => 'ERROR',
+ );
+
+ /**
+ * {@inheritdoc}
+ */
+ public function format(array $record)
+ {
+ // Retrieve the line and file if set and remove them from the formatted extra
+ $file = $line = '';
+ if (isset($record['extra']['file'])) {
+ $file = $record['extra']['file'];
+ unset($record['extra']['file']);
+ }
+ if (isset($record['extra']['line'])) {
+ $line = $record['extra']['line'];
+ unset($record['extra']['line']);
+ }
+
+ $record = $this->normalize($record);
+ $message = array('message' => $record['message']);
+ $handleError = false;
+ if ($record['context']) {
+ $message['context'] = $record['context'];
+ $handleError = true;
+ }
+ if ($record['extra']) {
+ $message['extra'] = $record['extra'];
+ $handleError = true;
+ }
+ if (count($message) === 1) {
+ $message = reset($message);
+ }
+
+ if (isset($record['context'][self::TABLE])) {
+ $type = 'TABLE';
+ $label = $record['channel'] .': '. $record['message'];
+ $message = $record['context'][self::TABLE];
+ } else {
+ $type = $this->logLevels[$record['level']];
+ $label = $record['channel'];
+ }
+
+ // Create JSON object describing the appearance of the message in the console
+ $json = $this->toJson(array(
+ array(
+ 'Type' => $type,
+ 'File' => $file,
+ 'Line' => $line,
+ 'Label' => $label,
+ ),
+ $message,
+ ), $handleError);
+
+ // The message itself is a serialization of the above JSON object + it's length
+ return sprintf(
+ '%s|%s|',
+ strlen($json),
+ $json
+ );
+ }
+
+ public function formatBatch(array $records)
+ {
+ throw new \BadMethodCallException('Batch formatting does not make sense for the WildfireFormatter');
+ }
+
+ protected function normalize($data)
+ {
+ if (is_object($data) && !$data instanceof \DateTime) {
+ return $data;
+ }
+
+ return parent::normalize($data);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php
new file mode 100644
index 0000000..758a425
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php
@@ -0,0 +1,186 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\Formatter\FormatterInterface;
+use Monolog\Formatter\LineFormatter;
+
+/**
+ * Base Handler class providing the Handler structure
+ *
+ * @author Jordi Boggiano
+ */
+abstract class AbstractHandler implements HandlerInterface
+{
+ protected $level = Logger::DEBUG;
+ protected $bubble = true;
+
+ /**
+ * @var FormatterInterface
+ */
+ protected $formatter;
+ protected $processors = array();
+
+ /**
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct($level = Logger::DEBUG, $bubble = true)
+ {
+ $this->setLevel($level);
+ $this->bubble = $bubble;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isHandling(array $record)
+ {
+ return $record['level'] >= $this->level;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handleBatch(array $records)
+ {
+ foreach ($records as $record) {
+ $this->handle($record);
+ }
+ }
+
+ /**
+ * Closes the handler.
+ *
+ * This will be called automatically when the object is destroyed
+ */
+ public function close()
+ {
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function pushProcessor($callback)
+ {
+ if (!is_callable($callback)) {
+ throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given');
+ }
+ array_unshift($this->processors, $callback);
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function popProcessor()
+ {
+ if (!$this->processors) {
+ throw new \LogicException('You tried to pop from an empty processor stack.');
+ }
+
+ return array_shift($this->processors);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setFormatter(FormatterInterface $formatter)
+ {
+ $this->formatter = $formatter;
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getFormatter()
+ {
+ if (!$this->formatter) {
+ $this->formatter = $this->getDefaultFormatter();
+ }
+
+ return $this->formatter;
+ }
+
+ /**
+ * Sets minimum logging level at which this handler will be triggered.
+ *
+ * @param int|string $level Level or level name
+ * @return self
+ */
+ public function setLevel($level)
+ {
+ $this->level = Logger::toMonologLevel($level);
+
+ return $this;
+ }
+
+ /**
+ * Gets minimum logging level at which this handler will be triggered.
+ *
+ * @return int
+ */
+ public function getLevel()
+ {
+ return $this->level;
+ }
+
+ /**
+ * Sets the bubbling behavior.
+ *
+ * @param Boolean $bubble true means that this handler allows bubbling.
+ * false means that bubbling is not permitted.
+ * @return self
+ */
+ public function setBubble($bubble)
+ {
+ $this->bubble = $bubble;
+
+ return $this;
+ }
+
+ /**
+ * Gets the bubbling behavior.
+ *
+ * @return Boolean true means that this handler allows bubbling.
+ * false means that bubbling is not permitted.
+ */
+ public function getBubble()
+ {
+ return $this->bubble;
+ }
+
+ public function __destruct()
+ {
+ try {
+ $this->close();
+ } catch (\Exception $e) {
+ // do nothing
+ } catch (\Throwable $e) {
+ // do nothing
+ }
+ }
+
+ /**
+ * Gets the default formatter.
+ *
+ * @return FormatterInterface
+ */
+ protected function getDefaultFormatter()
+ {
+ return new LineFormatter();
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php
new file mode 100644
index 0000000..6f18f72
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php
@@ -0,0 +1,66 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+/**
+ * Base Handler class providing the Handler structure
+ *
+ * Classes extending it should (in most cases) only implement write($record)
+ *
+ * @author Jordi Boggiano
+ * @author Christophe Coevoet
+ */
+abstract class AbstractProcessingHandler extends AbstractHandler
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function handle(array $record)
+ {
+ if (!$this->isHandling($record)) {
+ return false;
+ }
+
+ $record = $this->processRecord($record);
+
+ $record['formatted'] = $this->getFormatter()->format($record);
+
+ $this->write($record);
+
+ return false === $this->bubble;
+ }
+
+ /**
+ * Writes the record down to the log of the implementing handler
+ *
+ * @param array $record
+ * @return void
+ */
+ abstract protected function write(array $record);
+
+ /**
+ * Processes a record.
+ *
+ * @param array $record
+ * @return array
+ */
+ protected function processRecord(array $record)
+ {
+ if ($this->processors) {
+ foreach ($this->processors as $processor) {
+ $record = call_user_func($processor, $record);
+ }
+ }
+
+ return $record;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php
new file mode 100644
index 0000000..e2b2832
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php
@@ -0,0 +1,101 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\Formatter\LineFormatter;
+
+/**
+ * Common syslog functionality
+ */
+abstract class AbstractSyslogHandler extends AbstractProcessingHandler
+{
+ protected $facility;
+
+ /**
+ * Translates Monolog log levels to syslog log priorities.
+ */
+ protected $logLevels = array(
+ Logger::DEBUG => LOG_DEBUG,
+ Logger::INFO => LOG_INFO,
+ Logger::NOTICE => LOG_NOTICE,
+ Logger::WARNING => LOG_WARNING,
+ Logger::ERROR => LOG_ERR,
+ Logger::CRITICAL => LOG_CRIT,
+ Logger::ALERT => LOG_ALERT,
+ Logger::EMERGENCY => LOG_EMERG,
+ );
+
+ /**
+ * List of valid log facility names.
+ */
+ protected $facilities = array(
+ 'auth' => LOG_AUTH,
+ 'authpriv' => LOG_AUTHPRIV,
+ 'cron' => LOG_CRON,
+ 'daemon' => LOG_DAEMON,
+ 'kern' => LOG_KERN,
+ 'lpr' => LOG_LPR,
+ 'mail' => LOG_MAIL,
+ 'news' => LOG_NEWS,
+ 'syslog' => LOG_SYSLOG,
+ 'user' => LOG_USER,
+ 'uucp' => LOG_UUCP,
+ );
+
+ /**
+ * @param mixed $facility
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true)
+ {
+ parent::__construct($level, $bubble);
+
+ if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
+ $this->facilities['local0'] = LOG_LOCAL0;
+ $this->facilities['local1'] = LOG_LOCAL1;
+ $this->facilities['local2'] = LOG_LOCAL2;
+ $this->facilities['local3'] = LOG_LOCAL3;
+ $this->facilities['local4'] = LOG_LOCAL4;
+ $this->facilities['local5'] = LOG_LOCAL5;
+ $this->facilities['local6'] = LOG_LOCAL6;
+ $this->facilities['local7'] = LOG_LOCAL7;
+ } else {
+ $this->facilities['local0'] = 128; // LOG_LOCAL0
+ $this->facilities['local1'] = 136; // LOG_LOCAL1
+ $this->facilities['local2'] = 144; // LOG_LOCAL2
+ $this->facilities['local3'] = 152; // LOG_LOCAL3
+ $this->facilities['local4'] = 160; // LOG_LOCAL4
+ $this->facilities['local5'] = 168; // LOG_LOCAL5
+ $this->facilities['local6'] = 176; // LOG_LOCAL6
+ $this->facilities['local7'] = 184; // LOG_LOCAL7
+ }
+
+ // convert textual description of facility to syslog constant
+ if (array_key_exists(strtolower($facility), $this->facilities)) {
+ $facility = $this->facilities[strtolower($facility)];
+ } elseif (!in_array($facility, array_values($this->facilities), true)) {
+ throw new \UnexpectedValueException('Unknown facility value "'.$facility.'" given');
+ }
+
+ $this->facility = $facility;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new LineFormatter('%channel%.%level_name%: %message% %context% %extra%');
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php
new file mode 100644
index 0000000..e5a46bc
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php
@@ -0,0 +1,148 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\Formatter\JsonFormatter;
+use PhpAmqpLib\Message\AMQPMessage;
+use PhpAmqpLib\Channel\AMQPChannel;
+use AMQPExchange;
+
+class AmqpHandler extends AbstractProcessingHandler
+{
+ /**
+ * @var AMQPExchange|AMQPChannel $exchange
+ */
+ protected $exchange;
+
+ /**
+ * @var string
+ */
+ protected $exchangeName;
+
+ /**
+ * @param AMQPExchange|AMQPChannel $exchange AMQPExchange (php AMQP ext) or PHP AMQP lib channel, ready for use
+ * @param string $exchangeName
+ * @param int $level
+ * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct($exchange, $exchangeName = 'log', $level = Logger::DEBUG, $bubble = true)
+ {
+ if ($exchange instanceof AMQPExchange) {
+ $exchange->setName($exchangeName);
+ } elseif ($exchange instanceof AMQPChannel) {
+ $this->exchangeName = $exchangeName;
+ } else {
+ throw new \InvalidArgumentException('PhpAmqpLib\Channel\AMQPChannel or AMQPExchange instance required');
+ }
+ $this->exchange = $exchange;
+
+ parent::__construct($level, $bubble);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function write(array $record)
+ {
+ $data = $record["formatted"];
+ $routingKey = $this->getRoutingKey($record);
+
+ if ($this->exchange instanceof AMQPExchange) {
+ $this->exchange->publish(
+ $data,
+ $routingKey,
+ 0,
+ array(
+ 'delivery_mode' => 2,
+ 'content_type' => 'application/json',
+ )
+ );
+ } else {
+ $this->exchange->basic_publish(
+ $this->createAmqpMessage($data),
+ $this->exchangeName,
+ $routingKey
+ );
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function handleBatch(array $records)
+ {
+ if ($this->exchange instanceof AMQPExchange) {
+ parent::handleBatch($records);
+
+ return;
+ }
+
+ foreach ($records as $record) {
+ if (!$this->isHandling($record)) {
+ continue;
+ }
+
+ $record = $this->processRecord($record);
+ $data = $this->getFormatter()->format($record);
+
+ $this->exchange->batch_basic_publish(
+ $this->createAmqpMessage($data),
+ $this->exchangeName,
+ $this->getRoutingKey($record)
+ );
+ }
+
+ $this->exchange->publish_batch();
+ }
+
+ /**
+ * Gets the routing key for the AMQP exchange
+ *
+ * @param array $record
+ * @return string
+ */
+ protected function getRoutingKey(array $record)
+ {
+ $routingKey = sprintf(
+ '%s.%s',
+ // TODO 2.0 remove substr call
+ substr($record['level_name'], 0, 4),
+ $record['channel']
+ );
+
+ return strtolower($routingKey);
+ }
+
+ /**
+ * @param string $data
+ * @return AMQPMessage
+ */
+ private function createAmqpMessage($data)
+ {
+ return new AMQPMessage(
+ (string) $data,
+ array(
+ 'delivery_mode' => 2,
+ 'content_type' => 'application/json',
+ )
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php
new file mode 100644
index 0000000..b3a21bd
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php
@@ -0,0 +1,230 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\LineFormatter;
+
+/**
+ * Handler sending logs to browser's javascript console with no browser extension required
+ *
+ * @author Olivier Poitrey
+ */
+class BrowserConsoleHandler extends AbstractProcessingHandler
+{
+ protected static $initialized = false;
+ protected static $records = array();
+
+ /**
+ * {@inheritDoc}
+ *
+ * Formatted output may contain some formatting markers to be transferred to `console.log` using the %c format.
+ *
+ * Example of formatted string:
+ *
+ * You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new LineFormatter('[[%channel%]]{macro: autolabel} [[%level_name%]]{font-weight: bold} %message%');
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function write(array $record)
+ {
+ // Accumulate records
+ self::$records[] = $record;
+
+ // Register shutdown handler if not already done
+ if (!self::$initialized) {
+ self::$initialized = true;
+ $this->registerShutdownFunction();
+ }
+ }
+
+ /**
+ * Convert records to javascript console commands and send it to the browser.
+ * This method is automatically called on PHP shutdown if output is HTML or Javascript.
+ */
+ public static function send()
+ {
+ $format = self::getResponseFormat();
+ if ($format === 'unknown') {
+ return;
+ }
+
+ if (count(self::$records)) {
+ if ($format === 'html') {
+ self::writeOutput('');
+ } elseif ($format === 'js') {
+ self::writeOutput(self::generateScript());
+ }
+ self::reset();
+ }
+ }
+
+ /**
+ * Forget all logged records
+ */
+ public static function reset()
+ {
+ self::$records = array();
+ }
+
+ /**
+ * Wrapper for register_shutdown_function to allow overriding
+ */
+ protected function registerShutdownFunction()
+ {
+ if (PHP_SAPI !== 'cli') {
+ register_shutdown_function(array('Monolog\Handler\BrowserConsoleHandler', 'send'));
+ }
+ }
+
+ /**
+ * Wrapper for echo to allow overriding
+ *
+ * @param string $str
+ */
+ protected static function writeOutput($str)
+ {
+ echo $str;
+ }
+
+ /**
+ * Checks the format of the response
+ *
+ * If Content-Type is set to application/javascript or text/javascript -> js
+ * If Content-Type is set to text/html, or is unset -> html
+ * If Content-Type is anything else -> unknown
+ *
+ * @return string One of 'js', 'html' or 'unknown'
+ */
+ protected static function getResponseFormat()
+ {
+ // Check content type
+ foreach (headers_list() as $header) {
+ if (stripos($header, 'content-type:') === 0) {
+ // This handler only works with HTML and javascript outputs
+ // text/javascript is obsolete in favour of application/javascript, but still used
+ if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) {
+ return 'js';
+ }
+ if (stripos($header, 'text/html') === false) {
+ return 'unknown';
+ }
+ break;
+ }
+ }
+
+ return 'html';
+ }
+
+ private static function generateScript()
+ {
+ $script = array();
+ foreach (self::$records as $record) {
+ $context = self::dump('Context', $record['context']);
+ $extra = self::dump('Extra', $record['extra']);
+
+ if (empty($context) && empty($extra)) {
+ $script[] = self::call_array('log', self::handleStyles($record['formatted']));
+ } else {
+ $script = array_merge($script,
+ array(self::call_array('groupCollapsed', self::handleStyles($record['formatted']))),
+ $context,
+ $extra,
+ array(self::call('groupEnd'))
+ );
+ }
+ }
+
+ return "(function (c) {if (c && c.groupCollapsed) {\n" . implode("\n", $script) . "\n}})(console);";
+ }
+
+ private static function handleStyles($formatted)
+ {
+ $args = array(self::quote('font-weight: normal'));
+ $format = '%c' . $formatted;
+ preg_match_all('/\[\[(.*?)\]\]\{([^}]*)\}/s', $format, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
+
+ foreach (array_reverse($matches) as $match) {
+ $args[] = self::quote(self::handleCustomStyles($match[2][0], $match[1][0]));
+ $args[] = '"font-weight: normal"';
+
+ $pos = $match[0][1];
+ $format = substr($format, 0, $pos) . '%c' . $match[1][0] . '%c' . substr($format, $pos + strlen($match[0][0]));
+ }
+
+ array_unshift($args, self::quote($format));
+
+ return $args;
+ }
+
+ private static function handleCustomStyles($style, $string)
+ {
+ static $colors = array('blue', 'green', 'red', 'magenta', 'orange', 'black', 'grey');
+ static $labels = array();
+
+ return preg_replace_callback('/macro\s*:(.*?)(?:;|$)/', function ($m) use ($string, &$colors, &$labels) {
+ if (trim($m[1]) === 'autolabel') {
+ // Format the string as a label with consistent auto assigned background color
+ if (!isset($labels[$string])) {
+ $labels[$string] = $colors[count($labels) % count($colors)];
+ }
+ $color = $labels[$string];
+
+ return "background-color: $color; color: white; border-radius: 3px; padding: 0 2px 0 2px";
+ }
+
+ return $m[1];
+ }, $style);
+ }
+
+ private static function dump($title, array $dict)
+ {
+ $script = array();
+ $dict = array_filter($dict);
+ if (empty($dict)) {
+ return $script;
+ }
+ $script[] = self::call('log', self::quote('%c%s'), self::quote('font-weight: bold'), self::quote($title));
+ foreach ($dict as $key => $value) {
+ $value = json_encode($value);
+ if (empty($value)) {
+ $value = self::quote('');
+ }
+ $script[] = self::call('log', self::quote('%s: %o'), self::quote($key), $value);
+ }
+
+ return $script;
+ }
+
+ private static function quote($arg)
+ {
+ return '"' . addcslashes($arg, "\"\n\\") . '"';
+ }
+
+ private static function call()
+ {
+ $args = func_get_args();
+ $method = array_shift($args);
+
+ return self::call_array($method, $args);
+ }
+
+ private static function call_array($method, array $args)
+ {
+ return 'c.' . $method . '(' . implode(', ', $args) . ');';
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php
new file mode 100644
index 0000000..72f8953
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php
@@ -0,0 +1,117 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * Buffers all records until closing the handler and then pass them as batch.
+ *
+ * This is useful for a MailHandler to send only one mail per request instead of
+ * sending one per log message.
+ *
+ * @author Christophe Coevoet
+ */
+class BufferHandler extends AbstractHandler
+{
+ protected $handler;
+ protected $bufferSize = 0;
+ protected $bufferLimit;
+ protected $flushOnOverflow;
+ protected $buffer = array();
+ protected $initialized = false;
+
+ /**
+ * @param HandlerInterface $handler Handler.
+ * @param int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param Boolean $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded
+ */
+ public function __construct(HandlerInterface $handler, $bufferLimit = 0, $level = Logger::DEBUG, $bubble = true, $flushOnOverflow = false)
+ {
+ parent::__construct($level, $bubble);
+ $this->handler = $handler;
+ $this->bufferLimit = (int) $bufferLimit;
+ $this->flushOnOverflow = $flushOnOverflow;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handle(array $record)
+ {
+ if ($record['level'] < $this->level) {
+ return false;
+ }
+
+ if (!$this->initialized) {
+ // __destructor() doesn't get called on Fatal errors
+ register_shutdown_function(array($this, 'close'));
+ $this->initialized = true;
+ }
+
+ if ($this->bufferLimit > 0 && $this->bufferSize === $this->bufferLimit) {
+ if ($this->flushOnOverflow) {
+ $this->flush();
+ } else {
+ array_shift($this->buffer);
+ $this->bufferSize--;
+ }
+ }
+
+ if ($this->processors) {
+ foreach ($this->processors as $processor) {
+ $record = call_user_func($processor, $record);
+ }
+ }
+
+ $this->buffer[] = $record;
+ $this->bufferSize++;
+
+ return false === $this->bubble;
+ }
+
+ public function flush()
+ {
+ if ($this->bufferSize === 0) {
+ return;
+ }
+
+ $this->handler->handleBatch($this->buffer);
+ $this->clear();
+ }
+
+ public function __destruct()
+ {
+ // suppress the parent behavior since we already have register_shutdown_function()
+ // to call close(), and the reference contained there will prevent this from being
+ // GC'd until the end of the request
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function close()
+ {
+ $this->flush();
+ }
+
+ /**
+ * Clears the buffer without flushing any messages down to the wrapped handler.
+ */
+ public function clear()
+ {
+ $this->bufferSize = 0;
+ $this->buffer = array();
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php
new file mode 100644
index 0000000..785cb0c
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php
@@ -0,0 +1,211 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\ChromePHPFormatter;
+use Monolog\Logger;
+
+/**
+ * Handler sending logs to the ChromePHP extension (http://www.chromephp.com/)
+ *
+ * This also works out of the box with Firefox 43+
+ *
+ * @author Christophe Coevoet
+ */
+class ChromePHPHandler extends AbstractProcessingHandler
+{
+ /**
+ * Version of the extension
+ */
+ const VERSION = '4.0';
+
+ /**
+ * Header name
+ */
+ const HEADER_NAME = 'X-ChromeLogger-Data';
+
+ /**
+ * Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+)
+ */
+ const USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}';
+
+ protected static $initialized = false;
+
+ /**
+ * Tracks whether we sent too much data
+ *
+ * Chrome limits the headers to 256KB, so when we sent 240KB we stop sending
+ *
+ * @var Boolean
+ */
+ protected static $overflowed = false;
+
+ protected static $json = array(
+ 'version' => self::VERSION,
+ 'columns' => array('label', 'log', 'backtrace', 'type'),
+ 'rows' => array(),
+ );
+
+ protected static $sendHeaders = true;
+
+ /**
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct($level = Logger::DEBUG, $bubble = true)
+ {
+ parent::__construct($level, $bubble);
+ if (!function_exists('json_encode')) {
+ throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s ChromePHPHandler');
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handleBatch(array $records)
+ {
+ $messages = array();
+
+ foreach ($records as $record) {
+ if ($record['level'] < $this->level) {
+ continue;
+ }
+ $messages[] = $this->processRecord($record);
+ }
+
+ if (!empty($messages)) {
+ $messages = $this->getFormatter()->formatBatch($messages);
+ self::$json['rows'] = array_merge(self::$json['rows'], $messages);
+ $this->send();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new ChromePHPFormatter();
+ }
+
+ /**
+ * Creates & sends header for a record
+ *
+ * @see sendHeader()
+ * @see send()
+ * @param array $record
+ */
+ protected function write(array $record)
+ {
+ self::$json['rows'][] = $record['formatted'];
+
+ $this->send();
+ }
+
+ /**
+ * Sends the log header
+ *
+ * @see sendHeader()
+ */
+ protected function send()
+ {
+ if (self::$overflowed || !self::$sendHeaders) {
+ return;
+ }
+
+ if (!self::$initialized) {
+ self::$initialized = true;
+
+ self::$sendHeaders = $this->headersAccepted();
+ if (!self::$sendHeaders) {
+ return;
+ }
+
+ self::$json['request_uri'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
+ }
+
+ $json = @json_encode(self::$json);
+ $data = base64_encode(utf8_encode($json));
+ if (strlen($data) > 240 * 1024) {
+ self::$overflowed = true;
+
+ $record = array(
+ 'message' => 'Incomplete logs, chrome header size limit reached',
+ 'context' => array(),
+ 'level' => Logger::WARNING,
+ 'level_name' => Logger::getLevelName(Logger::WARNING),
+ 'channel' => 'monolog',
+ 'datetime' => new \DateTime(),
+ 'extra' => array(),
+ );
+ self::$json['rows'][count(self::$json['rows']) - 1] = $this->getFormatter()->format($record);
+ $json = @json_encode(self::$json);
+ $data = base64_encode(utf8_encode($json));
+ }
+
+ if (trim($data) !== '') {
+ $this->sendHeader(self::HEADER_NAME, $data);
+ }
+ }
+
+ /**
+ * Send header string to the client
+ *
+ * @param string $header
+ * @param string $content
+ */
+ protected function sendHeader($header, $content)
+ {
+ if (!headers_sent() && self::$sendHeaders) {
+ header(sprintf('%s: %s', $header, $content));
+ }
+ }
+
+ /**
+ * Verifies if the headers are accepted by the current user agent
+ *
+ * @return Boolean
+ */
+ protected function headersAccepted()
+ {
+ if (empty($_SERVER['HTTP_USER_AGENT'])) {
+ return false;
+ }
+
+ return preg_match(self::USER_AGENT_REGEX, $_SERVER['HTTP_USER_AGENT']);
+ }
+
+ /**
+ * BC getter for the sendHeaders property that has been made static
+ */
+ public function __get($property)
+ {
+ if ('sendHeaders' !== $property) {
+ throw new \InvalidArgumentException('Undefined property '.$property);
+ }
+
+ return static::$sendHeaders;
+ }
+
+ /**
+ * BC setter for the sendHeaders property that has been made static
+ */
+ public function __set($property, $value)
+ {
+ if ('sendHeaders' !== $property) {
+ throw new \InvalidArgumentException('Undefined property '.$property);
+ }
+
+ static::$sendHeaders = $value;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php
new file mode 100644
index 0000000..cc98697
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php
@@ -0,0 +1,72 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\JsonFormatter;
+use Monolog\Logger;
+
+/**
+ * CouchDB handler
+ *
+ * @author Markus Bachmann
+ */
+class CouchDBHandler extends AbstractProcessingHandler
+{
+ private $options;
+
+ public function __construct(array $options = array(), $level = Logger::DEBUG, $bubble = true)
+ {
+ $this->options = array_merge(array(
+ 'host' => 'localhost',
+ 'port' => 5984,
+ 'dbname' => 'logger',
+ 'username' => null,
+ 'password' => null,
+ ), $options);
+
+ parent::__construct($level, $bubble);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function write(array $record)
+ {
+ $basicAuth = null;
+ if ($this->options['username']) {
+ $basicAuth = sprintf('%s:%s@', $this->options['username'], $this->options['password']);
+ }
+
+ $url = 'http://'.$basicAuth.$this->options['host'].':'.$this->options['port'].'/'.$this->options['dbname'];
+ $context = stream_context_create(array(
+ 'http' => array(
+ 'method' => 'POST',
+ 'content' => $record['formatted'],
+ 'ignore_errors' => true,
+ 'max_redirects' => 0,
+ 'header' => 'Content-type: application/json',
+ ),
+ ));
+
+ if (false === @file_get_contents($url, null, $context)) {
+ throw new \RuntimeException(sprintf('Could not connect to %s', $url));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php
new file mode 100644
index 0000000..96b3ca0
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php
@@ -0,0 +1,151 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * Logs to Cube.
+ *
+ * @link http://square.github.com/cube/
+ * @author Wan Chen
+ */
+class CubeHandler extends AbstractProcessingHandler
+{
+ private $udpConnection;
+ private $httpConnection;
+ private $scheme;
+ private $host;
+ private $port;
+ private $acceptedSchemes = array('http', 'udp');
+
+ /**
+ * Create a Cube handler
+ *
+ * @throws \UnexpectedValueException when given url is not a valid url.
+ * A valid url must consist of three parts : protocol://host:port
+ * Only valid protocols used by Cube are http and udp
+ */
+ public function __construct($url, $level = Logger::DEBUG, $bubble = true)
+ {
+ $urlInfo = parse_url($url);
+
+ if (!isset($urlInfo['scheme'], $urlInfo['host'], $urlInfo['port'])) {
+ throw new \UnexpectedValueException('URL "'.$url.'" is not valid');
+ }
+
+ if (!in_array($urlInfo['scheme'], $this->acceptedSchemes)) {
+ throw new \UnexpectedValueException(
+ 'Invalid protocol (' . $urlInfo['scheme'] . ').'
+ . ' Valid options are ' . implode(', ', $this->acceptedSchemes));
+ }
+
+ $this->scheme = $urlInfo['scheme'];
+ $this->host = $urlInfo['host'];
+ $this->port = $urlInfo['port'];
+
+ parent::__construct($level, $bubble);
+ }
+
+ /**
+ * Establish a connection to an UDP socket
+ *
+ * @throws \LogicException when unable to connect to the socket
+ * @throws MissingExtensionException when there is no socket extension
+ */
+ protected function connectUdp()
+ {
+ if (!extension_loaded('sockets')) {
+ throw new MissingExtensionException('The sockets extension is required to use udp URLs with the CubeHandler');
+ }
+
+ $this->udpConnection = socket_create(AF_INET, SOCK_DGRAM, 0);
+ if (!$this->udpConnection) {
+ throw new \LogicException('Unable to create a socket');
+ }
+
+ if (!socket_connect($this->udpConnection, $this->host, $this->port)) {
+ throw new \LogicException('Unable to connect to the socket at ' . $this->host . ':' . $this->port);
+ }
+ }
+
+ /**
+ * Establish a connection to a http server
+ * @throws \LogicException when no curl extension
+ */
+ protected function connectHttp()
+ {
+ if (!extension_loaded('curl')) {
+ throw new \LogicException('The curl extension is needed to use http URLs with the CubeHandler');
+ }
+
+ $this->httpConnection = curl_init('http://'.$this->host.':'.$this->port.'/1.0/event/put');
+
+ if (!$this->httpConnection) {
+ throw new \LogicException('Unable to connect to ' . $this->host . ':' . $this->port);
+ }
+
+ curl_setopt($this->httpConnection, CURLOPT_CUSTOMREQUEST, "POST");
+ curl_setopt($this->httpConnection, CURLOPT_RETURNTRANSFER, true);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function write(array $record)
+ {
+ $date = $record['datetime'];
+
+ $data = array('time' => $date->format('Y-m-d\TH:i:s.uO'));
+ unset($record['datetime']);
+
+ if (isset($record['context']['type'])) {
+ $data['type'] = $record['context']['type'];
+ unset($record['context']['type']);
+ } else {
+ $data['type'] = $record['channel'];
+ }
+
+ $data['data'] = $record['context'];
+ $data['data']['level'] = $record['level'];
+
+ if ($this->scheme === 'http') {
+ $this->writeHttp(json_encode($data));
+ } else {
+ $this->writeUdp(json_encode($data));
+ }
+ }
+
+ private function writeUdp($data)
+ {
+ if (!$this->udpConnection) {
+ $this->connectUdp();
+ }
+
+ socket_send($this->udpConnection, $data, strlen($data), 0);
+ }
+
+ private function writeHttp($data)
+ {
+ if (!$this->httpConnection) {
+ $this->connectHttp();
+ }
+
+ curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '['.$data.']');
+ curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array(
+ 'Content-Type: application/json',
+ 'Content-Length: ' . strlen('['.$data.']'),
+ ));
+
+ Curl\Util::execute($this->httpConnection, 5, false);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php b/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php
new file mode 100644
index 0000000..48d30b3
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php
@@ -0,0 +1,57 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler\Curl;
+
+class Util
+{
+ private static $retriableErrorCodes = array(
+ CURLE_COULDNT_RESOLVE_HOST,
+ CURLE_COULDNT_CONNECT,
+ CURLE_HTTP_NOT_FOUND,
+ CURLE_READ_ERROR,
+ CURLE_OPERATION_TIMEOUTED,
+ CURLE_HTTP_POST_ERROR,
+ CURLE_SSL_CONNECT_ERROR,
+ );
+
+ /**
+ * Executes a CURL request with optional retries and exception on failure
+ *
+ * @param resource $ch curl handler
+ * @throws \RuntimeException
+ */
+ public static function execute($ch, $retries = 5, $closeAfterDone = true)
+ {
+ while ($retries--) {
+ if (curl_exec($ch) === false) {
+ $curlErrno = curl_errno($ch);
+
+ if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) {
+ $curlError = curl_error($ch);
+
+ if ($closeAfterDone) {
+ curl_close($ch);
+ }
+
+ throw new \RuntimeException(sprintf('Curl error (code %s): %s', $curlErrno, $curlError));
+ }
+
+ continue;
+ }
+
+ if ($closeAfterDone) {
+ curl_close($ch);
+ }
+ break;
+ }
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php
new file mode 100644
index 0000000..7778c22
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php
@@ -0,0 +1,169 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * Simple handler wrapper that deduplicates log records across multiple requests
+ *
+ * It also includes the BufferHandler functionality and will buffer
+ * all messages until the end of the request or flush() is called.
+ *
+ * This works by storing all log records' messages above $deduplicationLevel
+ * to the file specified by $deduplicationStore. When further logs come in at the end of the
+ * request (or when flush() is called), all those above $deduplicationLevel are checked
+ * against the existing stored logs. If they match and the timestamps in the stored log is
+ * not older than $time seconds, the new log record is discarded. If no log record is new, the
+ * whole data set is discarded.
+ *
+ * This is mainly useful in combination with Mail handlers or things like Slack or HipChat handlers
+ * that send messages to people, to avoid spamming with the same message over and over in case of
+ * a major component failure like a database server being down which makes all requests fail in the
+ * same way.
+ *
+ * @author Jordi Boggiano
+ */
+class DeduplicationHandler extends BufferHandler
+{
+ /**
+ * @var string
+ */
+ protected $deduplicationStore;
+
+ /**
+ * @var int
+ */
+ protected $deduplicationLevel;
+
+ /**
+ * @var int
+ */
+ protected $time;
+
+ /**
+ * @var bool
+ */
+ private $gc = false;
+
+ /**
+ * @param HandlerInterface $handler Handler.
+ * @param string $deduplicationStore The file/path where the deduplication log should be kept
+ * @param int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes
+ * @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct(HandlerInterface $handler, $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, $time = 60, $bubble = true)
+ {
+ parent::__construct($handler, 0, Logger::DEBUG, $bubble, false);
+
+ $this->deduplicationStore = $deduplicationStore === null ? sys_get_temp_dir() . '/monolog-dedup-' . substr(md5(__FILE__), 0, 20) .'.log' : $deduplicationStore;
+ $this->deduplicationLevel = Logger::toMonologLevel($deduplicationLevel);
+ $this->time = $time;
+ }
+
+ public function flush()
+ {
+ if ($this->bufferSize === 0) {
+ return;
+ }
+
+ $passthru = null;
+
+ foreach ($this->buffer as $record) {
+ if ($record['level'] >= $this->deduplicationLevel) {
+
+ $passthru = $passthru || !$this->isDuplicate($record);
+ if ($passthru) {
+ $this->appendRecord($record);
+ }
+ }
+ }
+
+ // default of null is valid as well as if no record matches duplicationLevel we just pass through
+ if ($passthru === true || $passthru === null) {
+ $this->handler->handleBatch($this->buffer);
+ }
+
+ $this->clear();
+
+ if ($this->gc) {
+ $this->collectLogs();
+ }
+ }
+
+ private function isDuplicate(array $record)
+ {
+ if (!file_exists($this->deduplicationStore)) {
+ return false;
+ }
+
+ $store = file($this->deduplicationStore, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
+ if (!is_array($store)) {
+ return false;
+ }
+
+ $yesterday = time() - 86400;
+ $timestampValidity = $record['datetime']->getTimestamp() - $this->time;
+ $expectedMessage = preg_replace('{[\r\n].*}', '', $record['message']);
+
+ for ($i = count($store) - 1; $i >= 0; $i--) {
+ list($timestamp, $level, $message) = explode(':', $store[$i], 3);
+
+ if ($level === $record['level_name'] && $message === $expectedMessage && $timestamp > $timestampValidity) {
+ return true;
+ }
+
+ if ($timestamp < $yesterday) {
+ $this->gc = true;
+ }
+ }
+
+ return false;
+ }
+
+ private function collectLogs()
+ {
+ if (!file_exists($this->deduplicationStore)) {
+ return false;
+ }
+
+ $handle = fopen($this->deduplicationStore, 'rw+');
+ flock($handle, LOCK_EX);
+ $validLogs = array();
+
+ $timestampValidity = time() - $this->time;
+
+ while (!feof($handle)) {
+ $log = fgets($handle);
+ if (substr($log, 0, 10) >= $timestampValidity) {
+ $validLogs[] = $log;
+ }
+ }
+
+ ftruncate($handle, 0);
+ rewind($handle);
+ foreach ($validLogs as $log) {
+ fwrite($handle, $log);
+ }
+
+ flock($handle, LOCK_UN);
+ fclose($handle);
+
+ $this->gc = false;
+ }
+
+ private function appendRecord(array $record)
+ {
+ file_put_contents($this->deduplicationStore, $record['datetime']->getTimestamp() . ':' . $record['level_name'] . ':' . preg_replace('{[\r\n].*}', '', $record['message']) . "\n", FILE_APPEND);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php
new file mode 100644
index 0000000..b91ffec
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php
@@ -0,0 +1,45 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\Formatter\NormalizerFormatter;
+use Doctrine\CouchDB\CouchDBClient;
+
+/**
+ * CouchDB handler for Doctrine CouchDB ODM
+ *
+ * @author Markus Bachmann
+ */
+class DoctrineCouchDBHandler extends AbstractProcessingHandler
+{
+ private $client;
+
+ public function __construct(CouchDBClient $client, $level = Logger::DEBUG, $bubble = true)
+ {
+ $this->client = $client;
+ parent::__construct($level, $bubble);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function write(array $record)
+ {
+ $this->client->postDocument($record['formatted']);
+ }
+
+ protected function getDefaultFormatter()
+ {
+ return new NormalizerFormatter;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php
new file mode 100644
index 0000000..237b71f
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php
@@ -0,0 +1,107 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Aws\Sdk;
+use Aws\DynamoDb\DynamoDbClient;
+use Aws\DynamoDb\Marshaler;
+use Monolog\Formatter\ScalarFormatter;
+use Monolog\Logger;
+
+/**
+ * Amazon DynamoDB handler (http://aws.amazon.com/dynamodb/)
+ *
+ * @link https://github.com/aws/aws-sdk-php/
+ * @author Andrew Lawson
+ */
+class DynamoDbHandler extends AbstractProcessingHandler
+{
+ const DATE_FORMAT = 'Y-m-d\TH:i:s.uO';
+
+ /**
+ * @var DynamoDbClient
+ */
+ protected $client;
+
+ /**
+ * @var string
+ */
+ protected $table;
+
+ /**
+ * @var int
+ */
+ protected $version;
+
+ /**
+ * @var Marshaler
+ */
+ protected $marshaler;
+
+ /**
+ * @param DynamoDbClient $client
+ * @param string $table
+ * @param int $level
+ * @param bool $bubble
+ */
+ public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true)
+ {
+ if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) {
+ $this->version = 3;
+ $this->marshaler = new Marshaler;
+ } else {
+ $this->version = 2;
+ }
+
+ $this->client = $client;
+ $this->table = $table;
+
+ parent::__construct($level, $bubble);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function write(array $record)
+ {
+ $filtered = $this->filterEmptyFields($record['formatted']);
+ if ($this->version === 3) {
+ $formatted = $this->marshaler->marshalItem($filtered);
+ } else {
+ $formatted = $this->client->formatAttributes($filtered);
+ }
+
+ $this->client->putItem(array(
+ 'TableName' => $this->table,
+ 'Item' => $formatted,
+ ));
+ }
+
+ /**
+ * @param array $record
+ * @return array
+ */
+ protected function filterEmptyFields(array $record)
+ {
+ return array_filter($record, function ($value) {
+ return !empty($value) || false === $value || 0 === $value;
+ });
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new ScalarFormatter(self::DATE_FORMAT);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php
new file mode 100644
index 0000000..8196740
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php
@@ -0,0 +1,128 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\FormatterInterface;
+use Monolog\Formatter\ElasticaFormatter;
+use Monolog\Logger;
+use Elastica\Client;
+use Elastica\Exception\ExceptionInterface;
+
+/**
+ * Elastic Search handler
+ *
+ * Usage example:
+ *
+ * $client = new \Elastica\Client();
+ * $options = array(
+ * 'index' => 'elastic_index_name',
+ * 'type' => 'elastic_doc_type',
+ * );
+ * $handler = new ElasticSearchHandler($client, $options);
+ * $log = new Logger('application');
+ * $log->pushHandler($handler);
+ *
+ * @author Jelle Vink
+ */
+class ElasticSearchHandler extends AbstractProcessingHandler
+{
+ /**
+ * @var Client
+ */
+ protected $client;
+
+ /**
+ * @var array Handler config options
+ */
+ protected $options = array();
+
+ /**
+ * @param Client $client Elastica Client object
+ * @param array $options Handler configuration
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct(Client $client, array $options = array(), $level = Logger::DEBUG, $bubble = true)
+ {
+ parent::__construct($level, $bubble);
+ $this->client = $client;
+ $this->options = array_merge(
+ array(
+ 'index' => 'monolog', // Elastic index name
+ 'type' => 'record', // Elastic document type
+ 'ignore_error' => false, // Suppress Elastica exceptions
+ ),
+ $options
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function write(array $record)
+ {
+ $this->bulkSend(array($record['formatted']));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setFormatter(FormatterInterface $formatter)
+ {
+ if ($formatter instanceof ElasticaFormatter) {
+ return parent::setFormatter($formatter);
+ }
+ throw new \InvalidArgumentException('ElasticSearchHandler is only compatible with ElasticaFormatter');
+ }
+
+ /**
+ * Getter options
+ * @return array
+ */
+ public function getOptions()
+ {
+ return $this->options;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new ElasticaFormatter($this->options['index'], $this->options['type']);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handleBatch(array $records)
+ {
+ $documents = $this->getFormatter()->formatBatch($records);
+ $this->bulkSend($documents);
+ }
+
+ /**
+ * Use Elasticsearch bulk API to send list of documents
+ * @param array $documents
+ * @throws \RuntimeException
+ */
+ protected function bulkSend(array $documents)
+ {
+ try {
+ $this->client->addDocuments($documents);
+ } catch (ExceptionInterface $e) {
+ if (!$this->options['ignore_error']) {
+ throw new \RuntimeException("Error sending messages to Elasticsearch", 0, $e);
+ }
+ }
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php
new file mode 100644
index 0000000..1447a58
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php
@@ -0,0 +1,82 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\LineFormatter;
+use Monolog\Logger;
+
+/**
+ * Stores to PHP error_log() handler.
+ *
+ * @author Elan Ruusamäe
+ */
+class ErrorLogHandler extends AbstractProcessingHandler
+{
+ const OPERATING_SYSTEM = 0;
+ const SAPI = 4;
+
+ protected $messageType;
+ protected $expandNewlines;
+
+ /**
+ * @param int $messageType Says where the error should go.
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param Boolean $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries
+ */
+ public function __construct($messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, $bubble = true, $expandNewlines = false)
+ {
+ parent::__construct($level, $bubble);
+
+ if (false === in_array($messageType, self::getAvailableTypes())) {
+ $message = sprintf('The given message type "%s" is not supported', print_r($messageType, true));
+ throw new \InvalidArgumentException($message);
+ }
+
+ $this->messageType = $messageType;
+ $this->expandNewlines = $expandNewlines;
+ }
+
+ /**
+ * @return array With all available types
+ */
+ public static function getAvailableTypes()
+ {
+ return array(
+ self::OPERATING_SYSTEM,
+ self::SAPI,
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new LineFormatter('[%datetime%] %channel%.%level_name%: %message% %context% %extra%');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function write(array $record)
+ {
+ if ($this->expandNewlines) {
+ $lines = preg_split('{[\r\n]+}', (string) $record['formatted']);
+ foreach ($lines as $line) {
+ error_log($line, $this->messageType);
+ }
+ } else {
+ error_log((string) $record['formatted'], $this->messageType);
+ }
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php
new file mode 100644
index 0000000..2a0f7fd
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php
@@ -0,0 +1,140 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * Simple handler wrapper that filters records based on a list of levels
+ *
+ * It can be configured with an exact list of levels to allow, or a min/max level.
+ *
+ * @author Hennadiy Verkh
+ * @author Jordi Boggiano
+ */
+class FilterHandler extends AbstractHandler
+{
+ /**
+ * Handler or factory callable($record, $this)
+ *
+ * @var callable|\Monolog\Handler\HandlerInterface
+ */
+ protected $handler;
+
+ /**
+ * Minimum level for logs that are passed to handler
+ *
+ * @var int[]
+ */
+ protected $acceptedLevels;
+
+ /**
+ * Whether the messages that are handled can bubble up the stack or not
+ *
+ * @var Boolean
+ */
+ protected $bubble;
+
+ /**
+ * @param callable|HandlerInterface $handler Handler or factory callable($record, $this).
+ * @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided
+ * @param int $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct($handler, $minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY, $bubble = true)
+ {
+ $this->handler = $handler;
+ $this->bubble = $bubble;
+ $this->setAcceptedLevels($minLevelOrList, $maxLevel);
+
+ if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) {
+ throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object");
+ }
+ }
+
+ /**
+ * @return array
+ */
+ public function getAcceptedLevels()
+ {
+ return array_flip($this->acceptedLevels);
+ }
+
+ /**
+ * @param int|string|array $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided
+ * @param int|string $maxLevel Maximum level or level name to accept, only used if $minLevelOrList is not an array
+ */
+ public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY)
+ {
+ if (is_array($minLevelOrList)) {
+ $acceptedLevels = array_map('Monolog\Logger::toMonologLevel', $minLevelOrList);
+ } else {
+ $minLevelOrList = Logger::toMonologLevel($minLevelOrList);
+ $maxLevel = Logger::toMonologLevel($maxLevel);
+ $acceptedLevels = array_values(array_filter(Logger::getLevels(), function ($level) use ($minLevelOrList, $maxLevel) {
+ return $level >= $minLevelOrList && $level <= $maxLevel;
+ }));
+ }
+ $this->acceptedLevels = array_flip($acceptedLevels);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isHandling(array $record)
+ {
+ return isset($this->acceptedLevels[$record['level']]);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handle(array $record)
+ {
+ if (!$this->isHandling($record)) {
+ return false;
+ }
+
+ // The same logic as in FingersCrossedHandler
+ if (!$this->handler instanceof HandlerInterface) {
+ $this->handler = call_user_func($this->handler, $record, $this);
+ if (!$this->handler instanceof HandlerInterface) {
+ throw new \RuntimeException("The factory callable should return a HandlerInterface");
+ }
+ }
+
+ if ($this->processors) {
+ foreach ($this->processors as $processor) {
+ $record = call_user_func($processor, $record);
+ }
+ }
+
+ $this->handler->handle($record);
+
+ return false === $this->bubble;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handleBatch(array $records)
+ {
+ $filtered = array();
+ foreach ($records as $record) {
+ if ($this->isHandling($record)) {
+ $filtered[] = $record;
+ }
+ }
+
+ $this->handler->handleBatch($filtered);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php
new file mode 100644
index 0000000..c3e42ef
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php
@@ -0,0 +1,28 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler\FingersCrossed;
+
+/**
+ * Interface for activation strategies for the FingersCrossedHandler.
+ *
+ * @author Johannes M. Schmitt
+ */
+interface ActivationStrategyInterface
+{
+ /**
+ * Returns whether the given record activates the handler.
+ *
+ * @param array $record
+ * @return Boolean
+ */
+ public function isHandlerActivated(array $record);
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php
new file mode 100644
index 0000000..2a2a64d
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php
@@ -0,0 +1,59 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler\FingersCrossed;
+
+use Monolog\Logger;
+
+/**
+ * Channel and Error level based monolog activation strategy. Allows to trigger activation
+ * based on level per channel. e.g. trigger activation on level 'ERROR' by default, except
+ * for records of the 'sql' channel; those should trigger activation on level 'WARN'.
+ *
+ * Example:
+ *
+ *
+ * $activationStrategy = new ChannelLevelActivationStrategy(
+ * Logger::CRITICAL,
+ * array(
+ * 'request' => Logger::ALERT,
+ * 'sensitive' => Logger::ERROR,
+ * )
+ * );
+ * $handler = new FingersCrossedHandler(new StreamHandler('php://stderr'), $activationStrategy);
+ *
+ *
+ * @author Mike Meessen
+ */
+class ChannelLevelActivationStrategy implements ActivationStrategyInterface
+{
+ private $defaultActionLevel;
+ private $channelToActionLevel;
+
+ /**
+ * @param int $defaultActionLevel The default action level to be used if the record's category doesn't match any
+ * @param array $channelToActionLevel An array that maps channel names to action levels.
+ */
+ public function __construct($defaultActionLevel, $channelToActionLevel = array())
+ {
+ $this->defaultActionLevel = Logger::toMonologLevel($defaultActionLevel);
+ $this->channelToActionLevel = array_map('Monolog\Logger::toMonologLevel', $channelToActionLevel);
+ }
+
+ public function isHandlerActivated(array $record)
+ {
+ if (isset($this->channelToActionLevel[$record['channel']])) {
+ return $record['level'] >= $this->channelToActionLevel[$record['channel']];
+ }
+
+ return $record['level'] >= $this->defaultActionLevel;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php
new file mode 100644
index 0000000..6e63085
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php
@@ -0,0 +1,34 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler\FingersCrossed;
+
+use Monolog\Logger;
+
+/**
+ * Error level based activation strategy.
+ *
+ * @author Johannes M. Schmitt
+ */
+class ErrorLevelActivationStrategy implements ActivationStrategyInterface
+{
+ private $actionLevel;
+
+ public function __construct($actionLevel)
+ {
+ $this->actionLevel = Logger::toMonologLevel($actionLevel);
+ }
+
+ public function isHandlerActivated(array $record)
+ {
+ return $record['level'] >= $this->actionLevel;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php
new file mode 100644
index 0000000..d1dcaac
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php
@@ -0,0 +1,163 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
+use Monolog\Handler\FingersCrossed\ActivationStrategyInterface;
+use Monolog\Logger;
+
+/**
+ * Buffers all records until a certain level is reached
+ *
+ * The advantage of this approach is that you don't get any clutter in your log files.
+ * Only requests which actually trigger an error (or whatever your actionLevel is) will be
+ * in the logs, but they will contain all records, not only those above the level threshold.
+ *
+ * You can find the various activation strategies in the
+ * Monolog\Handler\FingersCrossed\ namespace.
+ *
+ * @author Jordi Boggiano
+ */
+class FingersCrossedHandler extends AbstractHandler
+{
+ protected $handler;
+ protected $activationStrategy;
+ protected $buffering = true;
+ protected $bufferSize;
+ protected $buffer = array();
+ protected $stopBuffering;
+ protected $passthruLevel;
+
+ /**
+ * @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler).
+ * @param int|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action
+ * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param Boolean $stopBuffering Whether the handler should stop buffering after being triggered (default true)
+ * @param int $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered
+ */
+ public function __construct($handler, $activationStrategy = null, $bufferSize = 0, $bubble = true, $stopBuffering = true, $passthruLevel = null)
+ {
+ if (null === $activationStrategy) {
+ $activationStrategy = new ErrorLevelActivationStrategy(Logger::WARNING);
+ }
+
+ // convert simple int activationStrategy to an object
+ if (!$activationStrategy instanceof ActivationStrategyInterface) {
+ $activationStrategy = new ErrorLevelActivationStrategy($activationStrategy);
+ }
+
+ $this->handler = $handler;
+ $this->activationStrategy = $activationStrategy;
+ $this->bufferSize = $bufferSize;
+ $this->bubble = $bubble;
+ $this->stopBuffering = $stopBuffering;
+
+ if ($passthruLevel !== null) {
+ $this->passthruLevel = Logger::toMonologLevel($passthruLevel);
+ }
+
+ if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) {
+ throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object");
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isHandling(array $record)
+ {
+ return true;
+ }
+
+ /**
+ * Manually activate this logger regardless of the activation strategy
+ */
+ public function activate()
+ {
+ if ($this->stopBuffering) {
+ $this->buffering = false;
+ }
+ if (!$this->handler instanceof HandlerInterface) {
+ $record = end($this->buffer) ?: null;
+
+ $this->handler = call_user_func($this->handler, $record, $this);
+ if (!$this->handler instanceof HandlerInterface) {
+ throw new \RuntimeException("The factory callable should return a HandlerInterface");
+ }
+ }
+ $this->handler->handleBatch($this->buffer);
+ $this->buffer = array();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handle(array $record)
+ {
+ if ($this->processors) {
+ foreach ($this->processors as $processor) {
+ $record = call_user_func($processor, $record);
+ }
+ }
+
+ if ($this->buffering) {
+ $this->buffer[] = $record;
+ if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) {
+ array_shift($this->buffer);
+ }
+ if ($this->activationStrategy->isHandlerActivated($record)) {
+ $this->activate();
+ }
+ } else {
+ $this->handler->handle($record);
+ }
+
+ return false === $this->bubble;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function close()
+ {
+ if (null !== $this->passthruLevel) {
+ $level = $this->passthruLevel;
+ $this->buffer = array_filter($this->buffer, function ($record) use ($level) {
+ return $record['level'] >= $level;
+ });
+ if (count($this->buffer) > 0) {
+ $this->handler->handleBatch($this->buffer);
+ $this->buffer = array();
+ }
+ }
+ }
+
+ /**
+ * Resets the state of the handler. Stops forwarding records to the wrapped handler.
+ */
+ public function reset()
+ {
+ $this->buffering = true;
+ }
+
+ /**
+ * Clears the buffer without flushing any messages down to the wrapped handler.
+ *
+ * It also resets the handler to its initial buffering state.
+ */
+ public function clear()
+ {
+ $this->buffer = array();
+ $this->reset();
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php
new file mode 100644
index 0000000..fee4795
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php
@@ -0,0 +1,195 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\WildfireFormatter;
+
+/**
+ * Simple FirePHP Handler (http://www.firephp.org/), which uses the Wildfire protocol.
+ *
+ * @author Eric Clemmons (@ericclemmons)
+ */
+class FirePHPHandler extends AbstractProcessingHandler
+{
+ /**
+ * WildFire JSON header message format
+ */
+ const PROTOCOL_URI = 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2';
+
+ /**
+ * FirePHP structure for parsing messages & their presentation
+ */
+ const STRUCTURE_URI = 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1';
+
+ /**
+ * Must reference a "known" plugin, otherwise headers won't display in FirePHP
+ */
+ const PLUGIN_URI = 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3';
+
+ /**
+ * Header prefix for Wildfire to recognize & parse headers
+ */
+ const HEADER_PREFIX = 'X-Wf';
+
+ /**
+ * Whether or not Wildfire vendor-specific headers have been generated & sent yet
+ */
+ protected static $initialized = false;
+
+ /**
+ * Shared static message index between potentially multiple handlers
+ * @var int
+ */
+ protected static $messageIndex = 1;
+
+ protected static $sendHeaders = true;
+
+ /**
+ * Base header creation function used by init headers & record headers
+ *
+ * @param array $meta Wildfire Plugin, Protocol & Structure Indexes
+ * @param string $message Log message
+ * @return array Complete header string ready for the client as key and message as value
+ */
+ protected function createHeader(array $meta, $message)
+ {
+ $header = sprintf('%s-%s', self::HEADER_PREFIX, join('-', $meta));
+
+ return array($header => $message);
+ }
+
+ /**
+ * Creates message header from record
+ *
+ * @see createHeader()
+ * @param array $record
+ * @return string
+ */
+ protected function createRecordHeader(array $record)
+ {
+ // Wildfire is extensible to support multiple protocols & plugins in a single request,
+ // but we're not taking advantage of that (yet), so we're using "1" for simplicity's sake.
+ return $this->createHeader(
+ array(1, 1, 1, self::$messageIndex++),
+ $record['formatted']
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new WildfireFormatter();
+ }
+
+ /**
+ * Wildfire initialization headers to enable message parsing
+ *
+ * @see createHeader()
+ * @see sendHeader()
+ * @return array
+ */
+ protected function getInitHeaders()
+ {
+ // Initial payload consists of required headers for Wildfire
+ return array_merge(
+ $this->createHeader(array('Protocol', 1), self::PROTOCOL_URI),
+ $this->createHeader(array(1, 'Structure', 1), self::STRUCTURE_URI),
+ $this->createHeader(array(1, 'Plugin', 1), self::PLUGIN_URI)
+ );
+ }
+
+ /**
+ * Send header string to the client
+ *
+ * @param string $header
+ * @param string $content
+ */
+ protected function sendHeader($header, $content)
+ {
+ if (!headers_sent() && self::$sendHeaders) {
+ header(sprintf('%s: %s', $header, $content));
+ }
+ }
+
+ /**
+ * Creates & sends header for a record, ensuring init headers have been sent prior
+ *
+ * @see sendHeader()
+ * @see sendInitHeaders()
+ * @param array $record
+ */
+ protected function write(array $record)
+ {
+ if (!self::$sendHeaders) {
+ return;
+ }
+
+ // WildFire-specific headers must be sent prior to any messages
+ if (!self::$initialized) {
+ self::$initialized = true;
+
+ self::$sendHeaders = $this->headersAccepted();
+ if (!self::$sendHeaders) {
+ return;
+ }
+
+ foreach ($this->getInitHeaders() as $header => $content) {
+ $this->sendHeader($header, $content);
+ }
+ }
+
+ $header = $this->createRecordHeader($record);
+ if (trim(current($header)) !== '') {
+ $this->sendHeader(key($header), current($header));
+ }
+ }
+
+ /**
+ * Verifies if the headers are accepted by the current user agent
+ *
+ * @return Boolean
+ */
+ protected function headersAccepted()
+ {
+ if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT'])) {
+ return true;
+ }
+
+ return isset($_SERVER['HTTP_X_FIREPHP_VERSION']);
+ }
+
+ /**
+ * BC getter for the sendHeaders property that has been made static
+ */
+ public function __get($property)
+ {
+ if ('sendHeaders' !== $property) {
+ throw new \InvalidArgumentException('Undefined property '.$property);
+ }
+
+ return static::$sendHeaders;
+ }
+
+ /**
+ * BC setter for the sendHeaders property that has been made static
+ */
+ public function __set($property, $value)
+ {
+ if ('sendHeaders' !== $property) {
+ throw new \InvalidArgumentException('Undefined property '.$property);
+ }
+
+ static::$sendHeaders = $value;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php
new file mode 100644
index 0000000..c43c013
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php
@@ -0,0 +1,126 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\LineFormatter;
+use Monolog\Logger;
+
+/**
+ * Sends logs to Fleep.io using Webhook integrations
+ *
+ * You'll need a Fleep.io account to use this handler.
+ *
+ * @see https://fleep.io/integrations/webhooks/ Fleep Webhooks Documentation
+ * @author Ando Roots
+ */
+class FleepHookHandler extends SocketHandler
+{
+ const FLEEP_HOST = 'fleep.io';
+
+ const FLEEP_HOOK_URI = '/hook/';
+
+ /**
+ * @var string Webhook token (specifies the conversation where logs are sent)
+ */
+ protected $token;
+
+ /**
+ * Construct a new Fleep.io Handler.
+ *
+ * For instructions on how to create a new web hook in your conversations
+ * see https://fleep.io/integrations/webhooks/
+ *
+ * @param string $token Webhook token
+ * @param bool|int $level The minimum logging level at which this handler will be triggered
+ * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
+ * @throws MissingExtensionException
+ */
+ public function __construct($token, $level = Logger::DEBUG, $bubble = true)
+ {
+ if (!extension_loaded('openssl')) {
+ throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FleepHookHandler');
+ }
+
+ $this->token = $token;
+
+ $connectionString = 'ssl://' . self::FLEEP_HOST . ':443';
+ parent::__construct($connectionString, $level, $bubble);
+ }
+
+ /**
+ * Returns the default formatter to use with this handler
+ *
+ * Overloaded to remove empty context and extra arrays from the end of the log message.
+ *
+ * @return LineFormatter
+ */
+ protected function getDefaultFormatter()
+ {
+ return new LineFormatter(null, null, true, true);
+ }
+
+ /**
+ * Handles a log record
+ *
+ * @param array $record
+ */
+ public function write(array $record)
+ {
+ parent::write($record);
+ $this->closeSocket();
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @param array $record
+ * @return string
+ */
+ protected function generateDataStream($record)
+ {
+ $content = $this->buildContent($record);
+
+ return $this->buildHeader($content) . $content;
+ }
+
+ /**
+ * Builds the header of the API Call
+ *
+ * @param string $content
+ * @return string
+ */
+ private function buildHeader($content)
+ {
+ $header = "POST " . self::FLEEP_HOOK_URI . $this->token . " HTTP/1.1\r\n";
+ $header .= "Host: " . self::FLEEP_HOST . "\r\n";
+ $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
+ $header .= "Content-Length: " . strlen($content) . "\r\n";
+ $header .= "\r\n";
+
+ return $header;
+ }
+
+ /**
+ * Builds the body of API call
+ *
+ * @param array $record
+ * @return string
+ */
+ private function buildContent($record)
+ {
+ $dataArray = array(
+ 'message' => $record['formatted'],
+ );
+
+ return http_build_query($dataArray);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php
new file mode 100644
index 0000000..dd9a361
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php
@@ -0,0 +1,127 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\Formatter\FlowdockFormatter;
+use Monolog\Formatter\FormatterInterface;
+
+/**
+ * Sends notifications through the Flowdock push API
+ *
+ * This must be configured with a FlowdockFormatter instance via setFormatter()
+ *
+ * Notes:
+ * API token - Flowdock API token
+ *
+ * @author Dominik Liebler
+ * @see https://www.flowdock.com/api/push
+ */
+class FlowdockHandler extends SocketHandler
+{
+ /**
+ * @var string
+ */
+ protected $apiToken;
+
+ /**
+ * @param string $apiToken
+ * @param bool|int $level The minimum logging level at which this handler will be triggered
+ * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
+ *
+ * @throws MissingExtensionException if OpenSSL is missing
+ */
+ public function __construct($apiToken, $level = Logger::DEBUG, $bubble = true)
+ {
+ if (!extension_loaded('openssl')) {
+ throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FlowdockHandler');
+ }
+
+ parent::__construct('ssl://api.flowdock.com:443', $level, $bubble);
+ $this->apiToken = $apiToken;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setFormatter(FormatterInterface $formatter)
+ {
+ if (!$formatter instanceof FlowdockFormatter) {
+ throw new \InvalidArgumentException('The FlowdockHandler requires an instance of Monolog\Formatter\FlowdockFormatter to function correctly');
+ }
+
+ return parent::setFormatter($formatter);
+ }
+
+ /**
+ * Gets the default formatter.
+ *
+ * @return FormatterInterface
+ */
+ protected function getDefaultFormatter()
+ {
+ throw new \InvalidArgumentException('The FlowdockHandler must be configured (via setFormatter) with an instance of Monolog\Formatter\FlowdockFormatter to function correctly');
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @param array $record
+ */
+ protected function write(array $record)
+ {
+ parent::write($record);
+
+ $this->closeSocket();
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @param array $record
+ * @return string
+ */
+ protected function generateDataStream($record)
+ {
+ $content = $this->buildContent($record);
+
+ return $this->buildHeader($content) . $content;
+ }
+
+ /**
+ * Builds the body of API call
+ *
+ * @param array $record
+ * @return string
+ */
+ private function buildContent($record)
+ {
+ return json_encode($record['formatted']['flowdock']);
+ }
+
+ /**
+ * Builds the header of the API Call
+ *
+ * @param string $content
+ * @return string
+ */
+ private function buildHeader($content)
+ {
+ $header = "POST /v1/messages/team_inbox/" . $this->apiToken . " HTTP/1.1\r\n";
+ $header .= "Host: api.flowdock.com\r\n";
+ $header .= "Content-Type: application/json\r\n";
+ $header .= "Content-Length: " . strlen($content) . "\r\n";
+ $header .= "\r\n";
+
+ return $header;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php
new file mode 100644
index 0000000..d3847d8
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php
@@ -0,0 +1,73 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Gelf\IMessagePublisher;
+use Gelf\PublisherInterface;
+use Gelf\Publisher;
+use InvalidArgumentException;
+use Monolog\Logger;
+use Monolog\Formatter\GelfMessageFormatter;
+
+/**
+ * Handler to send messages to a Graylog2 (http://www.graylog2.org) server
+ *
+ * @author Matt Lehner
+ * @author Benjamin Zikarsky
+ */
+class GelfHandler extends AbstractProcessingHandler
+{
+ /**
+ * @var Publisher the publisher object that sends the message to the server
+ */
+ protected $publisher;
+
+ /**
+ * @param PublisherInterface|IMessagePublisher|Publisher $publisher a publisher object
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct($publisher, $level = Logger::DEBUG, $bubble = true)
+ {
+ parent::__construct($level, $bubble);
+
+ if (!$publisher instanceof Publisher && !$publisher instanceof IMessagePublisher && !$publisher instanceof PublisherInterface) {
+ throw new InvalidArgumentException('Invalid publisher, expected a Gelf\Publisher, Gelf\IMessagePublisher or Gelf\PublisherInterface instance');
+ }
+
+ $this->publisher = $publisher;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function close()
+ {
+ $this->publisher = null;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function write(array $record)
+ {
+ $this->publisher->publish($record['formatted']);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new GelfMessageFormatter();
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php
new file mode 100644
index 0000000..663f5a9
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php
@@ -0,0 +1,104 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\FormatterInterface;
+
+/**
+ * Forwards records to multiple handlers
+ *
+ * @author Lenar Lõhmus
+ */
+class GroupHandler extends AbstractHandler
+{
+ protected $handlers;
+
+ /**
+ * @param array $handlers Array of Handlers.
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct(array $handlers, $bubble = true)
+ {
+ foreach ($handlers as $handler) {
+ if (!$handler instanceof HandlerInterface) {
+ throw new \InvalidArgumentException('The first argument of the GroupHandler must be an array of HandlerInterface instances.');
+ }
+ }
+
+ $this->handlers = $handlers;
+ $this->bubble = $bubble;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isHandling(array $record)
+ {
+ foreach ($this->handlers as $handler) {
+ if ($handler->isHandling($record)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handle(array $record)
+ {
+ if ($this->processors) {
+ foreach ($this->processors as $processor) {
+ $record = call_user_func($processor, $record);
+ }
+ }
+
+ foreach ($this->handlers as $handler) {
+ $handler->handle($record);
+ }
+
+ return false === $this->bubble;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handleBatch(array $records)
+ {
+ if ($this->processors) {
+ $processed = array();
+ foreach ($records as $record) {
+ foreach ($this->processors as $processor) {
+ $processed[] = call_user_func($processor, $record);
+ }
+ }
+ $records = $processed;
+ }
+
+ foreach ($this->handlers as $handler) {
+ $handler->handleBatch($records);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setFormatter(FormatterInterface $formatter)
+ {
+ foreach ($this->handlers as $handler) {
+ $handler->setFormatter($formatter);
+ }
+
+ return $this;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php b/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php
new file mode 100644
index 0000000..d920c4b
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php
@@ -0,0 +1,90 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\FormatterInterface;
+
+/**
+ * Interface that all Monolog Handlers must implement
+ *
+ * @author Jordi Boggiano
+ */
+interface HandlerInterface
+{
+ /**
+ * Checks whether the given record will be handled by this handler.
+ *
+ * This is mostly done for performance reasons, to avoid calling processors for nothing.
+ *
+ * Handlers should still check the record levels within handle(), returning false in isHandling()
+ * is no guarantee that handle() will not be called, and isHandling() might not be called
+ * for a given record.
+ *
+ * @param array $record Partial log record containing only a level key
+ *
+ * @return Boolean
+ */
+ public function isHandling(array $record);
+
+ /**
+ * Handles a record.
+ *
+ * All records may be passed to this method, and the handler should discard
+ * those that it does not want to handle.
+ *
+ * The return value of this function controls the bubbling process of the handler stack.
+ * Unless the bubbling is interrupted (by returning true), the Logger class will keep on
+ * calling further handlers in the stack with a given log record.
+ *
+ * @param array $record The record to handle
+ * @return Boolean true means that this handler handled the record, and that bubbling is not permitted.
+ * false means the record was either not processed or that this handler allows bubbling.
+ */
+ public function handle(array $record);
+
+ /**
+ * Handles a set of records at once.
+ *
+ * @param array $records The records to handle (an array of record arrays)
+ */
+ public function handleBatch(array $records);
+
+ /**
+ * Adds a processor in the stack.
+ *
+ * @param callable $callback
+ * @return self
+ */
+ public function pushProcessor($callback);
+
+ /**
+ * Removes the processor on top of the stack and returns it.
+ *
+ * @return callable
+ */
+ public function popProcessor();
+
+ /**
+ * Sets the formatter.
+ *
+ * @param FormatterInterface $formatter
+ * @return self
+ */
+ public function setFormatter(FormatterInterface $formatter);
+
+ /**
+ * Gets the formatter.
+ *
+ * @return FormatterInterface
+ */
+ public function getFormatter();
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php b/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php
new file mode 100644
index 0000000..e540d80
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php
@@ -0,0 +1,108 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\FormatterInterface;
+
+/**
+ * This simple wrapper class can be used to extend handlers functionality.
+ *
+ * Example: A custom filtering that can be applied to any handler.
+ *
+ * Inherit from this class and override handle() like this:
+ *
+ * public function handle(array $record)
+ * {
+ * if ($record meets certain conditions) {
+ * return false;
+ * }
+ * return $this->handler->handle($record);
+ * }
+ *
+ * @author Alexey Karapetov
+ */
+class HandlerWrapper implements HandlerInterface
+{
+ /**
+ * @var HandlerInterface
+ */
+ protected $handler;
+
+ /**
+ * HandlerWrapper constructor.
+ * @param HandlerInterface $handler
+ */
+ public function __construct(HandlerInterface $handler)
+ {
+ $this->handler = $handler;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isHandling(array $record)
+ {
+ return $this->handler->isHandling($record);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handle(array $record)
+ {
+ return $this->handler->handle($record);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handleBatch(array $records)
+ {
+ return $this->handler->handleBatch($records);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function pushProcessor($callback)
+ {
+ $this->handler->pushProcessor($callback);
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function popProcessor()
+ {
+ return $this->handler->popProcessor();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setFormatter(FormatterInterface $formatter)
+ {
+ $this->handler->setFormatter($formatter);
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getFormatter()
+ {
+ return $this->handler->getFormatter();
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php
new file mode 100644
index 0000000..73049f3
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php
@@ -0,0 +1,350 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * Sends notifications through the hipchat api to a hipchat room
+ *
+ * Notes:
+ * API token - HipChat API token
+ * Room - HipChat Room Id or name, where messages are sent
+ * Name - Name used to send the message (from)
+ * notify - Should the message trigger a notification in the clients
+ * version - The API version to use (HipChatHandler::API_V1 | HipChatHandler::API_V2)
+ *
+ * @author Rafael Dohms
+ * @see https://www.hipchat.com/docs/api
+ */
+class HipChatHandler extends SocketHandler
+{
+ /**
+ * Use API version 1
+ */
+ const API_V1 = 'v1';
+
+ /**
+ * Use API version v2
+ */
+ const API_V2 = 'v2';
+
+ /**
+ * The maximum allowed length for the name used in the "from" field.
+ */
+ const MAXIMUM_NAME_LENGTH = 15;
+
+ /**
+ * The maximum allowed length for the message.
+ */
+ const MAXIMUM_MESSAGE_LENGTH = 9500;
+
+ /**
+ * @var string
+ */
+ private $token;
+
+ /**
+ * @var string
+ */
+ private $room;
+
+ /**
+ * @var string
+ */
+ private $name;
+
+ /**
+ * @var bool
+ */
+ private $notify;
+
+ /**
+ * @var string
+ */
+ private $format;
+
+ /**
+ * @var string
+ */
+ private $host;
+
+ /**
+ * @var string
+ */
+ private $version;
+
+ /**
+ * @param string $token HipChat API Token
+ * @param string $room The room that should be alerted of the message (Id or Name)
+ * @param string $name Name used in the "from" field.
+ * @param bool $notify Trigger a notification in clients or not
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param bool $useSSL Whether to connect via SSL.
+ * @param string $format The format of the messages (default to text, can be set to html if you have html in the messages)
+ * @param string $host The HipChat server hostname.
+ * @param string $version The HipChat API version (default HipChatHandler::API_V1)
+ */
+ public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $format = 'text', $host = 'api.hipchat.com', $version = self::API_V1)
+ {
+ if ($version == self::API_V1 && !$this->validateStringLength($name, static::MAXIMUM_NAME_LENGTH)) {
+ throw new \InvalidArgumentException('The supplied name is too long. HipChat\'s v1 API supports names up to 15 UTF-8 characters.');
+ }
+
+ $connectionString = $useSSL ? 'ssl://'.$host.':443' : $host.':80';
+ parent::__construct($connectionString, $level, $bubble);
+
+ $this->token = $token;
+ $this->name = $name;
+ $this->notify = $notify;
+ $this->room = $room;
+ $this->format = $format;
+ $this->host = $host;
+ $this->version = $version;
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @param array $record
+ * @return string
+ */
+ protected function generateDataStream($record)
+ {
+ $content = $this->buildContent($record);
+
+ return $this->buildHeader($content) . $content;
+ }
+
+ /**
+ * Builds the body of API call
+ *
+ * @param array $record
+ * @return string
+ */
+ private function buildContent($record)
+ {
+ $dataArray = array(
+ 'notify' => $this->version == self::API_V1 ?
+ ($this->notify ? 1 : 0) :
+ ($this->notify ? 'true' : 'false'),
+ 'message' => $record['formatted'],
+ 'message_format' => $this->format,
+ 'color' => $this->getAlertColor($record['level']),
+ );
+
+ if (!$this->validateStringLength($dataArray['message'], static::MAXIMUM_MESSAGE_LENGTH)) {
+ if (function_exists('mb_substr')) {
+ $dataArray['message'] = mb_substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]';
+ } else {
+ $dataArray['message'] = substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]';
+ }
+ }
+
+ // if we are using the legacy API then we need to send some additional information
+ if ($this->version == self::API_V1) {
+ $dataArray['room_id'] = $this->room;
+ }
+
+ // append the sender name if it is set
+ // always append it if we use the v1 api (it is required in v1)
+ if ($this->version == self::API_V1 || $this->name !== null) {
+ $dataArray['from'] = (string) $this->name;
+ }
+
+ return http_build_query($dataArray);
+ }
+
+ /**
+ * Builds the header of the API Call
+ *
+ * @param string $content
+ * @return string
+ */
+ private function buildHeader($content)
+ {
+ if ($this->version == self::API_V1) {
+ $header = "POST /v1/rooms/message?format=json&auth_token={$this->token} HTTP/1.1\r\n";
+ } else {
+ // needed for rooms with special (spaces, etc) characters in the name
+ $room = rawurlencode($this->room);
+ $header = "POST /v2/room/{$room}/notification?auth_token={$this->token} HTTP/1.1\r\n";
+ }
+
+ $header .= "Host: {$this->host}\r\n";
+ $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
+ $header .= "Content-Length: " . strlen($content) . "\r\n";
+ $header .= "\r\n";
+
+ return $header;
+ }
+
+ /**
+ * Assigns a color to each level of log records.
+ *
+ * @param int $level
+ * @return string
+ */
+ protected function getAlertColor($level)
+ {
+ switch (true) {
+ case $level >= Logger::ERROR:
+ return 'red';
+ case $level >= Logger::WARNING:
+ return 'yellow';
+ case $level >= Logger::INFO:
+ return 'green';
+ case $level == Logger::DEBUG:
+ return 'gray';
+ default:
+ return 'yellow';
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @param array $record
+ */
+ protected function write(array $record)
+ {
+ parent::write($record);
+ $this->closeSocket();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handleBatch(array $records)
+ {
+ if (count($records) == 0) {
+ return true;
+ }
+
+ $batchRecords = $this->combineRecords($records);
+
+ $handled = false;
+ foreach ($batchRecords as $batchRecord) {
+ if ($this->isHandling($batchRecord)) {
+ $this->write($batchRecord);
+ $handled = true;
+ }
+ }
+
+ if (!$handled) {
+ return false;
+ }
+
+ return false === $this->bubble;
+ }
+
+ /**
+ * Combines multiple records into one. Error level of the combined record
+ * will be the highest level from the given records. Datetime will be taken
+ * from the first record.
+ *
+ * @param $records
+ * @return array
+ */
+ private function combineRecords($records)
+ {
+ $batchRecord = null;
+ $batchRecords = array();
+ $messages = array();
+ $formattedMessages = array();
+ $level = 0;
+ $levelName = null;
+ $datetime = null;
+
+ foreach ($records as $record) {
+ $record = $this->processRecord($record);
+
+ if ($record['level'] > $level) {
+ $level = $record['level'];
+ $levelName = $record['level_name'];
+ }
+
+ if (null === $datetime) {
+ $datetime = $record['datetime'];
+ }
+
+ $messages[] = $record['message'];
+ $messageStr = implode(PHP_EOL, $messages);
+ $formattedMessages[] = $this->getFormatter()->format($record);
+ $formattedMessageStr = implode('', $formattedMessages);
+
+ $batchRecord = array(
+ 'message' => $messageStr,
+ 'formatted' => $formattedMessageStr,
+ 'context' => array(),
+ 'extra' => array(),
+ );
+
+ if (!$this->validateStringLength($batchRecord['formatted'], static::MAXIMUM_MESSAGE_LENGTH)) {
+ // Pop the last message and implode the remaining messages
+ $lastMessage = array_pop($messages);
+ $lastFormattedMessage = array_pop($formattedMessages);
+ $batchRecord['message'] = implode(PHP_EOL, $messages);
+ $batchRecord['formatted'] = implode('', $formattedMessages);
+
+ $batchRecords[] = $batchRecord;
+ $messages = array($lastMessage);
+ $formattedMessages = array($lastFormattedMessage);
+
+ $batchRecord = null;
+ }
+ }
+
+ if (null !== $batchRecord) {
+ $batchRecords[] = $batchRecord;
+ }
+
+ // Set the max level and datetime for all records
+ foreach ($batchRecords as &$batchRecord) {
+ $batchRecord = array_merge(
+ $batchRecord,
+ array(
+ 'level' => $level,
+ 'level_name' => $levelName,
+ 'datetime' => $datetime,
+ )
+ );
+ }
+
+ return $batchRecords;
+ }
+
+ /**
+ * Validates the length of a string.
+ *
+ * If the `mb_strlen()` function is available, it will use that, as HipChat
+ * allows UTF-8 characters. Otherwise, it will fall back to `strlen()`.
+ *
+ * Note that this might cause false failures in the specific case of using
+ * a valid name with less than 16 characters, but 16 or more bytes, on a
+ * system where `mb_strlen()` is unavailable.
+ *
+ * @param string $str
+ * @param int $length
+ *
+ * @return bool
+ */
+ private function validateStringLength($str, $length)
+ {
+ if (function_exists('mb_strlen')) {
+ return (mb_strlen($str) <= $length);
+ }
+
+ return (strlen($str) <= $length);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php
new file mode 100644
index 0000000..d60a3c8
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php
@@ -0,0 +1,69 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * IFTTTHandler uses cURL to trigger IFTTT Maker actions
+ *
+ * Register a secret key and trigger/event name at https://ifttt.com/maker
+ *
+ * value1 will be the channel from monolog's Logger constructor,
+ * value2 will be the level name (ERROR, WARNING, ..)
+ * value3 will be the log record's message
+ *
+ * @author Nehal Patel
+ */
+class IFTTTHandler extends AbstractProcessingHandler
+{
+ private $eventName;
+ private $secretKey;
+
+ /**
+ * @param string $eventName The name of the IFTTT Maker event that should be triggered
+ * @param string $secretKey A valid IFTTT secret key
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true)
+ {
+ $this->eventName = $eventName;
+ $this->secretKey = $secretKey;
+
+ parent::__construct($level, $bubble);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function write(array $record)
+ {
+ $postData = array(
+ "value1" => $record["channel"],
+ "value2" => $record["level_name"],
+ "value3" => $record["message"],
+ );
+ $postString = json_encode($postData);
+
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, "https://maker.ifttt.com/trigger/" . $this->eventName . "/with/key/" . $this->secretKey);
+ curl_setopt($ch, CURLOPT_POST, true);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
+ "Content-Type: application/json",
+ ));
+
+ Curl\Util::execute($ch);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php
new file mode 100644
index 0000000..494c605
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php
@@ -0,0 +1,55 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * @author Robert Kaufmann III
+ */
+class LogEntriesHandler extends SocketHandler
+{
+ /**
+ * @var string
+ */
+ protected $logToken;
+
+ /**
+ * @param string $token Log token supplied by LogEntries
+ * @param bool $useSSL Whether or not SSL encryption should be used.
+ * @param int $level The minimum logging level to trigger this handler
+ * @param bool $bubble Whether or not messages that are handled should bubble up the stack.
+ *
+ * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing
+ */
+ public function __construct($token, $useSSL = true, $level = Logger::DEBUG, $bubble = true)
+ {
+ if ($useSSL && !extension_loaded('openssl')) {
+ throw new MissingExtensionException('The OpenSSL PHP plugin is required to use SSL encrypted connection for LogEntriesHandler');
+ }
+
+ $endpoint = $useSSL ? 'ssl://data.logentries.com:443' : 'data.logentries.com:80';
+ parent::__construct($endpoint, $level, $bubble);
+ $this->logToken = $token;
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @param array $record
+ * @return string
+ */
+ protected function generateDataStream($record)
+ {
+ return $this->logToken . ' ' . $record['formatted'];
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php
new file mode 100644
index 0000000..bcd62e1
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php
@@ -0,0 +1,102 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\Formatter\LogglyFormatter;
+
+/**
+ * Sends errors to Loggly.
+ *
+ * @author Przemek Sobstel
+ * @author Adam Pancutt
+ * @author Gregory Barchard
+ */
+class LogglyHandler extends AbstractProcessingHandler
+{
+ const HOST = 'logs-01.loggly.com';
+ const ENDPOINT_SINGLE = 'inputs';
+ const ENDPOINT_BATCH = 'bulk';
+
+ protected $token;
+
+ protected $tag = array();
+
+ public function __construct($token, $level = Logger::DEBUG, $bubble = true)
+ {
+ if (!extension_loaded('curl')) {
+ throw new \LogicException('The curl extension is needed to use the LogglyHandler');
+ }
+
+ $this->token = $token;
+
+ parent::__construct($level, $bubble);
+ }
+
+ public function setTag($tag)
+ {
+ $tag = !empty($tag) ? $tag : array();
+ $this->tag = is_array($tag) ? $tag : array($tag);
+ }
+
+ public function addTag($tag)
+ {
+ if (!empty($tag)) {
+ $tag = is_array($tag) ? $tag : array($tag);
+ $this->tag = array_unique(array_merge($this->tag, $tag));
+ }
+ }
+
+ protected function write(array $record)
+ {
+ $this->send($record["formatted"], self::ENDPOINT_SINGLE);
+ }
+
+ public function handleBatch(array $records)
+ {
+ $level = $this->level;
+
+ $records = array_filter($records, function ($record) use ($level) {
+ return ($record['level'] >= $level);
+ });
+
+ if ($records) {
+ $this->send($this->getFormatter()->formatBatch($records), self::ENDPOINT_BATCH);
+ }
+ }
+
+ protected function send($data, $endpoint)
+ {
+ $url = sprintf("https://%s/%s/%s/", self::HOST, $endpoint, $this->token);
+
+ $headers = array('Content-Type: application/json');
+
+ if (!empty($this->tag)) {
+ $headers[] = 'X-LOGGLY-TAG: '.implode(',', $this->tag);
+ }
+
+ $ch = curl_init();
+
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_POST, true);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+
+ Curl\Util::execute($ch);
+ }
+
+ protected function getDefaultFormatter()
+ {
+ return new LogglyFormatter();
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php
new file mode 100644
index 0000000..9e23283
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php
@@ -0,0 +1,67 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+/**
+ * Base class for all mail handlers
+ *
+ * @author Gyula Sallai
+ */
+abstract class MailHandler extends AbstractProcessingHandler
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function handleBatch(array $records)
+ {
+ $messages = array();
+
+ foreach ($records as $record) {
+ if ($record['level'] < $this->level) {
+ continue;
+ }
+ $messages[] = $this->processRecord($record);
+ }
+
+ if (!empty($messages)) {
+ $this->send((string) $this->getFormatter()->formatBatch($messages), $messages);
+ }
+ }
+
+ /**
+ * Send a mail with the given content
+ *
+ * @param string $content formatted email body to be sent
+ * @param array $records the array of log records that formed this content
+ */
+ abstract protected function send($content, array $records);
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function write(array $record)
+ {
+ $this->send((string) $record['formatted'], array($record));
+ }
+
+ protected function getHighestRecord(array $records)
+ {
+ $highestRecord = null;
+ foreach ($records as $record) {
+ if ($highestRecord === null || $highestRecord['level'] < $record['level']) {
+ $highestRecord = $record;
+ }
+ }
+
+ return $highestRecord;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php
new file mode 100644
index 0000000..ab95924
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php
@@ -0,0 +1,68 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * MandrillHandler uses cURL to send the emails to the Mandrill API
+ *
+ * @author Adam Nicholson
+ */
+class MandrillHandler extends MailHandler
+{
+ protected $message;
+ protected $apiKey;
+
+ /**
+ * @param string $apiKey A valid Mandrill API key
+ * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct($apiKey, $message, $level = Logger::ERROR, $bubble = true)
+ {
+ parent::__construct($level, $bubble);
+
+ if (!$message instanceof \Swift_Message && is_callable($message)) {
+ $message = call_user_func($message);
+ }
+ if (!$message instanceof \Swift_Message) {
+ throw new \InvalidArgumentException('You must provide either a Swift_Message instance or a callable returning it');
+ }
+ $this->message = $message;
+ $this->apiKey = $apiKey;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function send($content, array $records)
+ {
+ $message = clone $this->message;
+ $message->setBody($content);
+ $message->setDate(time());
+
+ $ch = curl_init();
+
+ curl_setopt($ch, CURLOPT_URL, 'https://mandrillapp.com/api/1.0/messages/send-raw.json');
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
+ 'key' => $this->apiKey,
+ 'raw_message' => (string) $message,
+ 'async' => false,
+ )));
+
+ Curl\Util::execute($ch);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php b/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php
new file mode 100644
index 0000000..4724a7e
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php
@@ -0,0 +1,21 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+/**
+ * Exception can be thrown if an extension for an handler is missing
+ *
+ * @author Christian Bergau
+ */
+class MissingExtensionException extends \Exception
+{
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php
new file mode 100644
index 0000000..56fe755
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php
@@ -0,0 +1,59 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\Formatter\NormalizerFormatter;
+
+/**
+ * Logs to a MongoDB database.
+ *
+ * usage example:
+ *
+ * $log = new Logger('application');
+ * $mongodb = new MongoDBHandler(new \Mongo("mongodb://localhost:27017"), "logs", "prod");
+ * $log->pushHandler($mongodb);
+ *
+ * @author Thomas Tourlourat
+ */
+class MongoDBHandler extends AbstractProcessingHandler
+{
+ protected $mongoCollection;
+
+ public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true)
+ {
+ if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo || $mongo instanceof \MongoDB\Client)) {
+ throw new \InvalidArgumentException('MongoClient, Mongo or MongoDB\Client instance required');
+ }
+
+ $this->mongoCollection = $mongo->selectCollection($database, $collection);
+
+ parent::__construct($level, $bubble);
+ }
+
+ protected function write(array $record)
+ {
+ if ($this->mongoCollection instanceof \MongoDB\Collection) {
+ $this->mongoCollection->insertOne($record["formatted"]);
+ } else {
+ $this->mongoCollection->save($record["formatted"]);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new NormalizerFormatter();
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php
new file mode 100644
index 0000000..d7807fd
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php
@@ -0,0 +1,185 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\Formatter\LineFormatter;
+
+/**
+ * NativeMailerHandler uses the mail() function to send the emails
+ *
+ * @author Christophe Coevoet
+ * @author Mark Garrett
+ */
+class NativeMailerHandler extends MailHandler
+{
+ /**
+ * The email addresses to which the message will be sent
+ * @var array
+ */
+ protected $to;
+
+ /**
+ * The subject of the email
+ * @var string
+ */
+ protected $subject;
+
+ /**
+ * Optional headers for the message
+ * @var array
+ */
+ protected $headers = array();
+
+ /**
+ * Optional parameters for the message
+ * @var array
+ */
+ protected $parameters = array();
+
+ /**
+ * The wordwrap length for the message
+ * @var int
+ */
+ protected $maxColumnWidth;
+
+ /**
+ * The Content-type for the message
+ * @var string
+ */
+ protected $contentType = 'text/plain';
+
+ /**
+ * The encoding for the message
+ * @var string
+ */
+ protected $encoding = 'utf-8';
+
+ /**
+ * @param string|array $to The receiver of the mail
+ * @param string $subject The subject of the mail
+ * @param string $from The sender of the mail
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param int $maxColumnWidth The maximum column width that the message lines will have
+ */
+ public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true, $maxColumnWidth = 70)
+ {
+ parent::__construct($level, $bubble);
+ $this->to = is_array($to) ? $to : array($to);
+ $this->subject = $subject;
+ $this->addHeader(sprintf('From: %s', $from));
+ $this->maxColumnWidth = $maxColumnWidth;
+ }
+
+ /**
+ * Add headers to the message
+ *
+ * @param string|array $headers Custom added headers
+ * @return self
+ */
+ public function addHeader($headers)
+ {
+ foreach ((array) $headers as $header) {
+ if (strpos($header, "\n") !== false || strpos($header, "\r") !== false) {
+ throw new \InvalidArgumentException('Headers can not contain newline characters for security reasons');
+ }
+ $this->headers[] = $header;
+ }
+
+ return $this;
+ }
+
+ /**
+ * Add parameters to the message
+ *
+ * @param string|array $parameters Custom added parameters
+ * @return self
+ */
+ public function addParameter($parameters)
+ {
+ $this->parameters = array_merge($this->parameters, (array) $parameters);
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function send($content, array $records)
+ {
+ $content = wordwrap($content, $this->maxColumnWidth);
+ $headers = ltrim(implode("\r\n", $this->headers) . "\r\n", "\r\n");
+ $headers .= 'Content-type: ' . $this->getContentType() . '; charset=' . $this->getEncoding() . "\r\n";
+ if ($this->getContentType() == 'text/html' && false === strpos($headers, 'MIME-Version:')) {
+ $headers .= 'MIME-Version: 1.0' . "\r\n";
+ }
+
+ $subject = $this->subject;
+ if ($records) {
+ $subjectFormatter = new LineFormatter($this->subject);
+ $subject = $subjectFormatter->format($this->getHighestRecord($records));
+ }
+
+ $parameters = implode(' ', $this->parameters);
+ foreach ($this->to as $to) {
+ mail($to, $subject, $content, $headers, $parameters);
+ }
+ }
+
+ /**
+ * @return string $contentType
+ */
+ public function getContentType()
+ {
+ return $this->contentType;
+ }
+
+ /**
+ * @return string $encoding
+ */
+ public function getEncoding()
+ {
+ return $this->encoding;
+ }
+
+ /**
+ * @param string $contentType The content type of the email - Defaults to text/plain. Use text/html for HTML
+ * messages.
+ * @return self
+ */
+ public function setContentType($contentType)
+ {
+ if (strpos($contentType, "\n") !== false || strpos($contentType, "\r") !== false) {
+ throw new \InvalidArgumentException('The content type can not contain newline characters to prevent email header injection');
+ }
+
+ $this->contentType = $contentType;
+
+ return $this;
+ }
+
+ /**
+ * @param string $encoding
+ * @return self
+ */
+ public function setEncoding($encoding)
+ {
+ if (strpos($encoding, "\n") !== false || strpos($encoding, "\r") !== false) {
+ throw new \InvalidArgumentException('The encoding can not contain newline characters to prevent email header injection');
+ }
+
+ $this->encoding = $encoding;
+
+ return $this;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php
new file mode 100644
index 0000000..6718e9e
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php
@@ -0,0 +1,202 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\Formatter\NormalizerFormatter;
+
+/**
+ * Class to record a log on a NewRelic application.
+ * Enabling New Relic High Security mode may prevent capture of useful information.
+ *
+ * @see https://docs.newrelic.com/docs/agents/php-agent
+ * @see https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security
+ */
+class NewRelicHandler extends AbstractProcessingHandler
+{
+ /**
+ * Name of the New Relic application that will receive logs from this handler.
+ *
+ * @var string
+ */
+ protected $appName;
+
+ /**
+ * Name of the current transaction
+ *
+ * @var string
+ */
+ protected $transactionName;
+
+ /**
+ * Some context and extra data is passed into the handler as arrays of values. Do we send them as is
+ * (useful if we are using the API), or explode them for display on the NewRelic RPM website?
+ *
+ * @var bool
+ */
+ protected $explodeArrays;
+
+ /**
+ * {@inheritDoc}
+ *
+ * @param string $appName
+ * @param bool $explodeArrays
+ * @param string $transactionName
+ */
+ public function __construct(
+ $level = Logger::ERROR,
+ $bubble = true,
+ $appName = null,
+ $explodeArrays = false,
+ $transactionName = null
+ ) {
+ parent::__construct($level, $bubble);
+
+ $this->appName = $appName;
+ $this->explodeArrays = $explodeArrays;
+ $this->transactionName = $transactionName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function write(array $record)
+ {
+ if (!$this->isNewRelicEnabled()) {
+ throw new MissingExtensionException('The newrelic PHP extension is required to use the NewRelicHandler');
+ }
+
+ if ($appName = $this->getAppName($record['context'])) {
+ $this->setNewRelicAppName($appName);
+ }
+
+ if ($transactionName = $this->getTransactionName($record['context'])) {
+ $this->setNewRelicTransactionName($transactionName);
+ unset($record['formatted']['context']['transaction_name']);
+ }
+
+ if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) {
+ newrelic_notice_error($record['message'], $record['context']['exception']);
+ unset($record['formatted']['context']['exception']);
+ } else {
+ newrelic_notice_error($record['message']);
+ }
+
+ if (isset($record['formatted']['context']) && is_array($record['formatted']['context'])) {
+ foreach ($record['formatted']['context'] as $key => $parameter) {
+ if (is_array($parameter) && $this->explodeArrays) {
+ foreach ($parameter as $paramKey => $paramValue) {
+ $this->setNewRelicParameter('context_' . $key . '_' . $paramKey, $paramValue);
+ }
+ } else {
+ $this->setNewRelicParameter('context_' . $key, $parameter);
+ }
+ }
+ }
+
+ if (isset($record['formatted']['extra']) && is_array($record['formatted']['extra'])) {
+ foreach ($record['formatted']['extra'] as $key => $parameter) {
+ if (is_array($parameter) && $this->explodeArrays) {
+ foreach ($parameter as $paramKey => $paramValue) {
+ $this->setNewRelicParameter('extra_' . $key . '_' . $paramKey, $paramValue);
+ }
+ } else {
+ $this->setNewRelicParameter('extra_' . $key, $parameter);
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks whether the NewRelic extension is enabled in the system.
+ *
+ * @return bool
+ */
+ protected function isNewRelicEnabled()
+ {
+ return extension_loaded('newrelic');
+ }
+
+ /**
+ * Returns the appname where this log should be sent. Each log can override the default appname, set in this
+ * handler's constructor, by providing the appname in it's context.
+ *
+ * @param array $context
+ * @return null|string
+ */
+ protected function getAppName(array $context)
+ {
+ if (isset($context['appname'])) {
+ return $context['appname'];
+ }
+
+ return $this->appName;
+ }
+
+ /**
+ * Returns the name of the current transaction. Each log can override the default transaction name, set in this
+ * handler's constructor, by providing the transaction_name in it's context
+ *
+ * @param array $context
+ *
+ * @return null|string
+ */
+ protected function getTransactionName(array $context)
+ {
+ if (isset($context['transaction_name'])) {
+ return $context['transaction_name'];
+ }
+
+ return $this->transactionName;
+ }
+
+ /**
+ * Sets the NewRelic application that should receive this log.
+ *
+ * @param string $appName
+ */
+ protected function setNewRelicAppName($appName)
+ {
+ newrelic_set_appname($appName);
+ }
+
+ /**
+ * Overwrites the name of the current transaction
+ *
+ * @param string $transactionName
+ */
+ protected function setNewRelicTransactionName($transactionName)
+ {
+ newrelic_name_transaction($transactionName);
+ }
+
+ /**
+ * @param string $key
+ * @param mixed $value
+ */
+ protected function setNewRelicParameter($key, $value)
+ {
+ if (null === $value || is_scalar($value)) {
+ newrelic_add_custom_parameter($key, $value);
+ } else {
+ newrelic_add_custom_parameter($key, @json_encode($value));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new NormalizerFormatter();
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php
new file mode 100644
index 0000000..4b84588
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php
@@ -0,0 +1,45 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * Blackhole
+ *
+ * Any record it can handle will be thrown away. This can be used
+ * to put on top of an existing stack to override it temporarily.
+ *
+ * @author Jordi Boggiano
+ */
+class NullHandler extends AbstractHandler
+{
+ /**
+ * @param int $level The minimum logging level at which this handler will be triggered
+ */
+ public function __construct($level = Logger::DEBUG)
+ {
+ parent::__construct($level, false);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handle(array $record)
+ {
+ if ($record['level'] < $this->level) {
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php
new file mode 100644
index 0000000..1f2076a
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php
@@ -0,0 +1,242 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Exception;
+use Monolog\Formatter\LineFormatter;
+use Monolog\Logger;
+use PhpConsole\Connector;
+use PhpConsole\Handler;
+use PhpConsole\Helper;
+
+/**
+ * Monolog handler for Google Chrome extension "PHP Console"
+ *
+ * Display PHP error/debug log messages in Google Chrome console and notification popups, executes PHP code remotely
+ *
+ * Usage:
+ * 1. Install Google Chrome extension https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef
+ * 2. See overview https://github.com/barbushin/php-console#overview
+ * 3. Install PHP Console library https://github.com/barbushin/php-console#installation
+ * 4. Example (result will looks like http://i.hizliresim.com/vg3Pz4.png)
+ *
+ * $logger = new \Monolog\Logger('all', array(new \Monolog\Handler\PHPConsoleHandler()));
+ * \Monolog\ErrorHandler::register($logger);
+ * echo $undefinedVar;
+ * $logger->addDebug('SELECT * FROM users', array('db', 'time' => 0.012));
+ * PC::debug($_SERVER); // PHP Console debugger for any type of vars
+ *
+ * @author Sergey Barbushin https://www.linkedin.com/in/barbushin
+ */
+class PHPConsoleHandler extends AbstractProcessingHandler
+{
+ private $options = array(
+ 'enabled' => true, // bool Is PHP Console server enabled
+ 'classesPartialsTraceIgnore' => array('Monolog\\'), // array Hide calls of classes started with...
+ 'debugTagsKeysInContext' => array(0, 'tag'), // bool Is PHP Console server enabled
+ 'useOwnErrorsHandler' => false, // bool Enable errors handling
+ 'useOwnExceptionsHandler' => false, // bool Enable exceptions handling
+ 'sourcesBasePath' => null, // string Base path of all project sources to strip in errors source paths
+ 'registerHelper' => true, // bool Register PhpConsole\Helper that allows short debug calls like PC::debug($var, 'ta.g.s')
+ 'serverEncoding' => null, // string|null Server internal encoding
+ 'headersLimit' => null, // int|null Set headers size limit for your web-server
+ 'password' => null, // string|null Protect PHP Console connection by password
+ 'enableSslOnlyMode' => false, // bool Force connection by SSL for clients with PHP Console installed
+ 'ipMasks' => array(), // array Set IP masks of clients that will be allowed to connect to PHP Console: array('192.168.*.*', '127.0.0.1')
+ 'enableEvalListener' => false, // bool Enable eval request to be handled by eval dispatcher(if enabled, 'password' option is also required)
+ 'dumperDetectCallbacks' => false, // bool Convert callback items in dumper vars to (callback SomeClass::someMethod) strings
+ 'dumperLevelLimit' => 5, // int Maximum dumped vars array or object nested dump level
+ 'dumperItemsCountLimit' => 100, // int Maximum dumped var same level array items or object properties number
+ 'dumperItemSizeLimit' => 5000, // int Maximum length of any string or dumped array item
+ 'dumperDumpSizeLimit' => 500000, // int Maximum approximate size of dumped vars result formatted in JSON
+ 'detectDumpTraceAndSource' => false, // bool Autodetect and append trace data to debug
+ 'dataStorage' => null, // PhpConsole\Storage|null Fixes problem with custom $_SESSION handler(see http://goo.gl/Ne8juJ)
+ );
+
+ /** @var Connector */
+ private $connector;
+
+ /**
+ * @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details
+ * @param Connector|null $connector Instance of \PhpConsole\Connector class (optional)
+ * @param int $level
+ * @param bool $bubble
+ * @throws Exception
+ */
+ public function __construct(array $options = array(), Connector $connector = null, $level = Logger::DEBUG, $bubble = true)
+ {
+ if (!class_exists('PhpConsole\Connector')) {
+ throw new Exception('PHP Console library not found. See https://github.com/barbushin/php-console#installation');
+ }
+ parent::__construct($level, $bubble);
+ $this->options = $this->initOptions($options);
+ $this->connector = $this->initConnector($connector);
+ }
+
+ private function initOptions(array $options)
+ {
+ $wrongOptions = array_diff(array_keys($options), array_keys($this->options));
+ if ($wrongOptions) {
+ throw new Exception('Unknown options: ' . implode(', ', $wrongOptions));
+ }
+
+ return array_replace($this->options, $options);
+ }
+
+ private function initConnector(Connector $connector = null)
+ {
+ if (!$connector) {
+ if ($this->options['dataStorage']) {
+ Connector::setPostponeStorage($this->options['dataStorage']);
+ }
+ $connector = Connector::getInstance();
+ }
+
+ if ($this->options['registerHelper'] && !Helper::isRegistered()) {
+ Helper::register();
+ }
+
+ if ($this->options['enabled'] && $connector->isActiveClient()) {
+ if ($this->options['useOwnErrorsHandler'] || $this->options['useOwnExceptionsHandler']) {
+ $handler = Handler::getInstance();
+ $handler->setHandleErrors($this->options['useOwnErrorsHandler']);
+ $handler->setHandleExceptions($this->options['useOwnExceptionsHandler']);
+ $handler->start();
+ }
+ if ($this->options['sourcesBasePath']) {
+ $connector->setSourcesBasePath($this->options['sourcesBasePath']);
+ }
+ if ($this->options['serverEncoding']) {
+ $connector->setServerEncoding($this->options['serverEncoding']);
+ }
+ if ($this->options['password']) {
+ $connector->setPassword($this->options['password']);
+ }
+ if ($this->options['enableSslOnlyMode']) {
+ $connector->enableSslOnlyMode();
+ }
+ if ($this->options['ipMasks']) {
+ $connector->setAllowedIpMasks($this->options['ipMasks']);
+ }
+ if ($this->options['headersLimit']) {
+ $connector->setHeadersLimit($this->options['headersLimit']);
+ }
+ if ($this->options['detectDumpTraceAndSource']) {
+ $connector->getDebugDispatcher()->detectTraceAndSource = true;
+ }
+ $dumper = $connector->getDumper();
+ $dumper->levelLimit = $this->options['dumperLevelLimit'];
+ $dumper->itemsCountLimit = $this->options['dumperItemsCountLimit'];
+ $dumper->itemSizeLimit = $this->options['dumperItemSizeLimit'];
+ $dumper->dumpSizeLimit = $this->options['dumperDumpSizeLimit'];
+ $dumper->detectCallbacks = $this->options['dumperDetectCallbacks'];
+ if ($this->options['enableEvalListener']) {
+ $connector->startEvalRequestsListener();
+ }
+ }
+
+ return $connector;
+ }
+
+ public function getConnector()
+ {
+ return $this->connector;
+ }
+
+ public function getOptions()
+ {
+ return $this->options;
+ }
+
+ public function handle(array $record)
+ {
+ if ($this->options['enabled'] && $this->connector->isActiveClient()) {
+ return parent::handle($record);
+ }
+
+ return !$this->bubble;
+ }
+
+ /**
+ * Writes the record down to the log of the implementing handler
+ *
+ * @param array $record
+ * @return void
+ */
+ protected function write(array $record)
+ {
+ if ($record['level'] < Logger::NOTICE) {
+ $this->handleDebugRecord($record);
+ } elseif (isset($record['context']['exception']) && $record['context']['exception'] instanceof Exception) {
+ $this->handleExceptionRecord($record);
+ } else {
+ $this->handleErrorRecord($record);
+ }
+ }
+
+ private function handleDebugRecord(array $record)
+ {
+ $tags = $this->getRecordTags($record);
+ $message = $record['message'];
+ if ($record['context']) {
+ $message .= ' ' . json_encode($this->connector->getDumper()->dump(array_filter($record['context'])));
+ }
+ $this->connector->getDebugDispatcher()->dispatchDebug($message, $tags, $this->options['classesPartialsTraceIgnore']);
+ }
+
+ private function handleExceptionRecord(array $record)
+ {
+ $this->connector->getErrorsDispatcher()->dispatchException($record['context']['exception']);
+ }
+
+ private function handleErrorRecord(array $record)
+ {
+ $context = $record['context'];
+
+ $this->connector->getErrorsDispatcher()->dispatchError(
+ isset($context['code']) ? $context['code'] : null,
+ isset($context['message']) ? $context['message'] : $record['message'],
+ isset($context['file']) ? $context['file'] : null,
+ isset($context['line']) ? $context['line'] : null,
+ $this->options['classesPartialsTraceIgnore']
+ );
+ }
+
+ private function getRecordTags(array &$record)
+ {
+ $tags = null;
+ if (!empty($record['context'])) {
+ $context = & $record['context'];
+ foreach ($this->options['debugTagsKeysInContext'] as $key) {
+ if (!empty($context[$key])) {
+ $tags = $context[$key];
+ if ($key === 0) {
+ array_shift($context);
+ } else {
+ unset($context[$key]);
+ }
+ break;
+ }
+ }
+ }
+
+ return $tags ?: strtolower($record['level_name']);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new LineFormatter('%message%');
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php
new file mode 100644
index 0000000..1ae8584
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php
@@ -0,0 +1,56 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Psr\Log\LoggerInterface;
+
+/**
+ * Proxies log messages to an existing PSR-3 compliant logger.
+ *
+ * @author Michael Moussa
+ */
+class PsrHandler extends AbstractHandler
+{
+ /**
+ * PSR-3 compliant logger
+ *
+ * @var LoggerInterface
+ */
+ protected $logger;
+
+ /**
+ * @param LoggerInterface $logger The underlying PSR-3 compliant logger to which messages will be proxied
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct(LoggerInterface $logger, $level = Logger::DEBUG, $bubble = true)
+ {
+ parent::__construct($level, $bubble);
+
+ $this->logger = $logger;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function handle(array $record)
+ {
+ if (!$this->isHandling($record)) {
+ return false;
+ }
+
+ $this->logger->log(strtolower($record['level_name']), $record['message'], $record['context']);
+
+ return false === $this->bubble;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php
new file mode 100644
index 0000000..bba7200
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php
@@ -0,0 +1,185 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * Sends notifications through the pushover api to mobile phones
+ *
+ * @author Sebastian Göttschkes
+ * @see https://www.pushover.net/api
+ */
+class PushoverHandler extends SocketHandler
+{
+ private $token;
+ private $users;
+ private $title;
+ private $user;
+ private $retry;
+ private $expire;
+
+ private $highPriorityLevel;
+ private $emergencyLevel;
+ private $useFormattedMessage = false;
+
+ /**
+ * All parameters that can be sent to Pushover
+ * @see https://pushover.net/api
+ * @var array
+ */
+ private $parameterNames = array(
+ 'token' => true,
+ 'user' => true,
+ 'message' => true,
+ 'device' => true,
+ 'title' => true,
+ 'url' => true,
+ 'url_title' => true,
+ 'priority' => true,
+ 'timestamp' => true,
+ 'sound' => true,
+ 'retry' => true,
+ 'expire' => true,
+ 'callback' => true,
+ );
+
+ /**
+ * Sounds the api supports by default
+ * @see https://pushover.net/api#sounds
+ * @var array
+ */
+ private $sounds = array(
+ 'pushover', 'bike', 'bugle', 'cashregister', 'classical', 'cosmic', 'falling', 'gamelan', 'incoming',
+ 'intermission', 'magic', 'mechanical', 'pianobar', 'siren', 'spacealarm', 'tugboat', 'alien', 'climb',
+ 'persistent', 'echo', 'updown', 'none',
+ );
+
+ /**
+ * @param string $token Pushover api token
+ * @param string|array $users Pushover user id or array of ids the message will be sent to
+ * @param string $title Title sent to the Pushover API
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param Boolean $useSSL Whether to connect via SSL. Required when pushing messages to users that are not
+ * the pushover.net app owner. OpenSSL is required for this option.
+ * @param int $highPriorityLevel The minimum logging level at which this handler will start
+ * sending "high priority" requests to the Pushover API
+ * @param int $emergencyLevel The minimum logging level at which this handler will start
+ * sending "emergency" requests to the Pushover API
+ * @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user.
+ * @param int $expire The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds).
+ */
+ public function __construct($token, $users, $title = null, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $highPriorityLevel = Logger::CRITICAL, $emergencyLevel = Logger::EMERGENCY, $retry = 30, $expire = 25200)
+ {
+ $connectionString = $useSSL ? 'ssl://api.pushover.net:443' : 'api.pushover.net:80';
+ parent::__construct($connectionString, $level, $bubble);
+
+ $this->token = $token;
+ $this->users = (array) $users;
+ $this->title = $title ?: gethostname();
+ $this->highPriorityLevel = Logger::toMonologLevel($highPriorityLevel);
+ $this->emergencyLevel = Logger::toMonologLevel($emergencyLevel);
+ $this->retry = $retry;
+ $this->expire = $expire;
+ }
+
+ protected function generateDataStream($record)
+ {
+ $content = $this->buildContent($record);
+
+ return $this->buildHeader($content) . $content;
+ }
+
+ private function buildContent($record)
+ {
+ // Pushover has a limit of 512 characters on title and message combined.
+ $maxMessageLength = 512 - strlen($this->title);
+
+ $message = ($this->useFormattedMessage) ? $record['formatted'] : $record['message'];
+ $message = substr($message, 0, $maxMessageLength);
+
+ $timestamp = $record['datetime']->getTimestamp();
+
+ $dataArray = array(
+ 'token' => $this->token,
+ 'user' => $this->user,
+ 'message' => $message,
+ 'title' => $this->title,
+ 'timestamp' => $timestamp,
+ );
+
+ if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) {
+ $dataArray['priority'] = 2;
+ $dataArray['retry'] = $this->retry;
+ $dataArray['expire'] = $this->expire;
+ } elseif (isset($record['level']) && $record['level'] >= $this->highPriorityLevel) {
+ $dataArray['priority'] = 1;
+ }
+
+ // First determine the available parameters
+ $context = array_intersect_key($record['context'], $this->parameterNames);
+ $extra = array_intersect_key($record['extra'], $this->parameterNames);
+
+ // Least important info should be merged with subsequent info
+ $dataArray = array_merge($extra, $context, $dataArray);
+
+ // Only pass sounds that are supported by the API
+ if (isset($dataArray['sound']) && !in_array($dataArray['sound'], $this->sounds)) {
+ unset($dataArray['sound']);
+ }
+
+ return http_build_query($dataArray);
+ }
+
+ private function buildHeader($content)
+ {
+ $header = "POST /1/messages.json HTTP/1.1\r\n";
+ $header .= "Host: api.pushover.net\r\n";
+ $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
+ $header .= "Content-Length: " . strlen($content) . "\r\n";
+ $header .= "\r\n";
+
+ return $header;
+ }
+
+ protected function write(array $record)
+ {
+ foreach ($this->users as $user) {
+ $this->user = $user;
+
+ parent::write($record);
+ $this->closeSocket();
+ }
+
+ $this->user = null;
+ }
+
+ public function setHighPriorityLevel($value)
+ {
+ $this->highPriorityLevel = $value;
+ }
+
+ public function setEmergencyLevel($value)
+ {
+ $this->emergencyLevel = $value;
+ }
+
+ /**
+ * Use the formatted message?
+ * @param bool $value
+ */
+ public function useFormattedMessage($value)
+ {
+ $this->useFormattedMessage = (boolean) $value;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php
new file mode 100644
index 0000000..53a8b39
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php
@@ -0,0 +1,232 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\LineFormatter;
+use Monolog\Formatter\FormatterInterface;
+use Monolog\Logger;
+use Raven_Client;
+
+/**
+ * Handler to send messages to a Sentry (https://github.com/getsentry/sentry) server
+ * using raven-php (https://github.com/getsentry/raven-php)
+ *
+ * @author Marc Abramowitz
+ */
+class RavenHandler extends AbstractProcessingHandler
+{
+ /**
+ * Translates Monolog log levels to Raven log levels.
+ */
+ private $logLevels = array(
+ Logger::DEBUG => Raven_Client::DEBUG,
+ Logger::INFO => Raven_Client::INFO,
+ Logger::NOTICE => Raven_Client::INFO,
+ Logger::WARNING => Raven_Client::WARNING,
+ Logger::ERROR => Raven_Client::ERROR,
+ Logger::CRITICAL => Raven_Client::FATAL,
+ Logger::ALERT => Raven_Client::FATAL,
+ Logger::EMERGENCY => Raven_Client::FATAL,
+ );
+
+ /**
+ * @var string should represent the current version of the calling
+ * software. Can be any string (git commit, version number)
+ */
+ private $release;
+
+ /**
+ * @var Raven_Client the client object that sends the message to the server
+ */
+ protected $ravenClient;
+
+ /**
+ * @var LineFormatter The formatter to use for the logs generated via handleBatch()
+ */
+ protected $batchFormatter;
+
+ /**
+ * @param Raven_Client $ravenClient
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true)
+ {
+ parent::__construct($level, $bubble);
+
+ $this->ravenClient = $ravenClient;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handleBatch(array $records)
+ {
+ $level = $this->level;
+
+ // filter records based on their level
+ $records = array_filter($records, function ($record) use ($level) {
+ return $record['level'] >= $level;
+ });
+
+ if (!$records) {
+ return;
+ }
+
+ // the record with the highest severity is the "main" one
+ $record = array_reduce($records, function ($highest, $record) {
+ if ($record['level'] > $highest['level']) {
+ return $record;
+ }
+
+ return $highest;
+ });
+
+ // the other ones are added as a context item
+ $logs = array();
+ foreach ($records as $r) {
+ $logs[] = $this->processRecord($r);
+ }
+
+ if ($logs) {
+ $record['context']['logs'] = (string) $this->getBatchFormatter()->formatBatch($logs);
+ }
+
+ $this->handle($record);
+ }
+
+ /**
+ * Sets the formatter for the logs generated by handleBatch().
+ *
+ * @param FormatterInterface $formatter
+ */
+ public function setBatchFormatter(FormatterInterface $formatter)
+ {
+ $this->batchFormatter = $formatter;
+ }
+
+ /**
+ * Gets the formatter for the logs generated by handleBatch().
+ *
+ * @return FormatterInterface
+ */
+ public function getBatchFormatter()
+ {
+ if (!$this->batchFormatter) {
+ $this->batchFormatter = $this->getDefaultBatchFormatter();
+ }
+
+ return $this->batchFormatter;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function write(array $record)
+ {
+ $previousUserContext = false;
+ $options = array();
+ $options['level'] = $this->logLevels[$record['level']];
+ $options['tags'] = array();
+ if (!empty($record['extra']['tags'])) {
+ $options['tags'] = array_merge($options['tags'], $record['extra']['tags']);
+ unset($record['extra']['tags']);
+ }
+ if (!empty($record['context']['tags'])) {
+ $options['tags'] = array_merge($options['tags'], $record['context']['tags']);
+ unset($record['context']['tags']);
+ }
+ if (!empty($record['context']['fingerprint'])) {
+ $options['fingerprint'] = $record['context']['fingerprint'];
+ unset($record['context']['fingerprint']);
+ }
+ if (!empty($record['context']['logger'])) {
+ $options['logger'] = $record['context']['logger'];
+ unset($record['context']['logger']);
+ } else {
+ $options['logger'] = $record['channel'];
+ }
+ foreach ($this->getExtraParameters() as $key) {
+ foreach (array('extra', 'context') as $source) {
+ if (!empty($record[$source][$key])) {
+ $options[$key] = $record[$source][$key];
+ unset($record[$source][$key]);
+ }
+ }
+ }
+ if (!empty($record['context'])) {
+ $options['extra']['context'] = $record['context'];
+ if (!empty($record['context']['user'])) {
+ $previousUserContext = $this->ravenClient->context->user;
+ $this->ravenClient->user_context($record['context']['user']);
+ unset($options['extra']['context']['user']);
+ }
+ }
+ if (!empty($record['extra'])) {
+ $options['extra']['extra'] = $record['extra'];
+ }
+
+ if (!empty($this->release) && !isset($options['release'])) {
+ $options['release'] = $this->release;
+ }
+
+ if (isset($record['context']['exception']) && ($record['context']['exception'] instanceof \Exception || (PHP_VERSION_ID >= 70000 && $record['context']['exception'] instanceof \Throwable))) {
+ $options['extra']['message'] = $record['formatted'];
+ $this->ravenClient->captureException($record['context']['exception'], $options);
+ } else {
+ $this->ravenClient->captureMessage($record['formatted'], array(), $options);
+ }
+
+ if ($previousUserContext !== false) {
+ $this->ravenClient->user_context($previousUserContext);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new LineFormatter('[%channel%] %message%');
+ }
+
+ /**
+ * Gets the default formatter for the logs generated by handleBatch().
+ *
+ * @return FormatterInterface
+ */
+ protected function getDefaultBatchFormatter()
+ {
+ return new LineFormatter();
+ }
+
+ /**
+ * Gets extra parameters supported by Raven that can be found in "extra" and "context"
+ *
+ * @return array
+ */
+ protected function getExtraParameters()
+ {
+ return array('checksum', 'release', 'event_id');
+ }
+
+ /**
+ * @param string $value
+ * @return self
+ */
+ public function setRelease($value)
+ {
+ $this->release = $value;
+
+ return $this;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php
new file mode 100644
index 0000000..590f996
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php
@@ -0,0 +1,97 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\LineFormatter;
+use Monolog\Logger;
+
+/**
+ * Logs to a Redis key using rpush
+ *
+ * usage example:
+ *
+ * $log = new Logger('application');
+ * $redis = new RedisHandler(new Predis\Client("tcp://localhost:6379"), "logs", "prod");
+ * $log->pushHandler($redis);
+ *
+ * @author Thomas Tourlourat
+ */
+class RedisHandler extends AbstractProcessingHandler
+{
+ private $redisClient;
+ private $redisKey;
+ protected $capSize;
+
+ /**
+ * @param \Predis\Client|\Redis $redis The redis instance
+ * @param string $key The key name to push records to
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param int $capSize Number of entries to limit list size to
+ */
+ public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true, $capSize = false)
+ {
+ if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) {
+ throw new \InvalidArgumentException('Predis\Client or Redis instance required');
+ }
+
+ $this->redisClient = $redis;
+ $this->redisKey = $key;
+ $this->capSize = $capSize;
+
+ parent::__construct($level, $bubble);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function write(array $record)
+ {
+ if ($this->capSize) {
+ $this->writeCapped($record);
+ } else {
+ $this->redisClient->rpush($this->redisKey, $record["formatted"]);
+ }
+ }
+
+ /**
+ * Write and cap the collection
+ * Writes the record to the redis list and caps its
+ *
+ * @param array $record associative record array
+ * @return void
+ */
+ protected function writeCapped(array $record)
+ {
+ if ($this->redisClient instanceof \Redis) {
+ $this->redisClient->multi()
+ ->rpush($this->redisKey, $record["formatted"])
+ ->ltrim($this->redisKey, -$this->capSize, -1)
+ ->exec();
+ } else {
+ $redisKey = $this->redisKey;
+ $capSize = $this->capSize;
+ $this->redisClient->transaction(function ($tx) use ($record, $redisKey, $capSize) {
+ $tx->rpush($redisKey, $record["formatted"]);
+ $tx->ltrim($redisKey, -$capSize, -1);
+ });
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDefaultFormatter()
+ {
+ return new LineFormatter();
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php
new file mode 100644
index 0000000..6c8a3e3
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php
@@ -0,0 +1,132 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use RollbarNotifier;
+use Exception;
+use Monolog\Logger;
+
+/**
+ * Sends errors to Rollbar
+ *
+ * If the context data contains a `payload` key, that is used as an array
+ * of payload options to RollbarNotifier's report_message/report_exception methods.
+ *
+ * Rollbar's context info will contain the context + extra keys from the log record
+ * merged, and then on top of that a few keys:
+ *
+ * - level (rollbar level name)
+ * - monolog_level (monolog level name, raw level, as rollbar only has 5 but monolog 8)
+ * - channel
+ * - datetime (unix timestamp)
+ *
+ * @author Paul Statezny
+ */
+class RollbarHandler extends AbstractProcessingHandler
+{
+ /**
+ * Rollbar notifier
+ *
+ * @var RollbarNotifier
+ */
+ protected $rollbarNotifier;
+
+ protected $levelMap = array(
+ Logger::DEBUG => 'debug',
+ Logger::INFO => 'info',
+ Logger::NOTICE => 'info',
+ Logger::WARNING => 'warning',
+ Logger::ERROR => 'error',
+ Logger::CRITICAL => 'critical',
+ Logger::ALERT => 'critical',
+ Logger::EMERGENCY => 'critical',
+ );
+
+ /**
+ * Records whether any log records have been added since the last flush of the rollbar notifier
+ *
+ * @var bool
+ */
+ private $hasRecords = false;
+
+ protected $initialized = false;
+
+ /**
+ * @param RollbarNotifier $rollbarNotifier RollbarNotifier object constructed with valid token
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct(RollbarNotifier $rollbarNotifier, $level = Logger::ERROR, $bubble = true)
+ {
+ $this->rollbarNotifier = $rollbarNotifier;
+
+ parent::__construct($level, $bubble);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function write(array $record)
+ {
+ if (!$this->initialized) {
+ // __destructor() doesn't get called on Fatal errors
+ register_shutdown_function(array($this, 'close'));
+ $this->initialized = true;
+ }
+
+ $context = $record['context'];
+ $payload = array();
+ if (isset($context['payload'])) {
+ $payload = $context['payload'];
+ unset($context['payload']);
+ }
+ $context = array_merge($context, $record['extra'], array(
+ 'level' => $this->levelMap[$record['level']],
+ 'monolog_level' => $record['level_name'],
+ 'channel' => $record['channel'],
+ 'datetime' => $record['datetime']->format('U'),
+ ));
+
+ if (isset($context['exception']) && $context['exception'] instanceof Exception) {
+ $payload['level'] = $context['level'];
+ $exception = $context['exception'];
+ unset($context['exception']);
+
+ $this->rollbarNotifier->report_exception($exception, $context, $payload);
+ } else {
+ $this->rollbarNotifier->report_message(
+ $record['message'],
+ $context['level'],
+ $context,
+ $payload
+ );
+ }
+
+ $this->hasRecords = true;
+ }
+
+ public function flush()
+ {
+ if ($this->hasRecords) {
+ $this->rollbarNotifier->flush();
+ $this->hasRecords = false;
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function close()
+ {
+ $this->flush();
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php
new file mode 100644
index 0000000..3b60b3d
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php
@@ -0,0 +1,178 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * Stores logs to files that are rotated every day and a limited number of files are kept.
+ *
+ * This rotation is only intended to be used as a workaround. Using logrotate to
+ * handle the rotation is strongly encouraged when you can use it.
+ *
+ * @author Christophe Coevoet
+ * @author Jordi Boggiano
+ */
+class RotatingFileHandler extends StreamHandler
+{
+ const FILE_PER_DAY = 'Y-m-d';
+ const FILE_PER_MONTH = 'Y-m';
+ const FILE_PER_YEAR = 'Y';
+
+ protected $filename;
+ protected $maxFiles;
+ protected $mustRotate;
+ protected $nextRotation;
+ protected $filenameFormat;
+ protected $dateFormat;
+
+ /**
+ * @param string $filename
+ * @param int $maxFiles The maximal amount of files to keep (0 means unlimited)
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write)
+ * @param Boolean $useLocking Try to lock log file before doing any writes
+ */
+ public function __construct($filename, $maxFiles = 0, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false)
+ {
+ $this->filename = $filename;
+ $this->maxFiles = (int) $maxFiles;
+ $this->nextRotation = new \DateTime('tomorrow');
+ $this->filenameFormat = '{filename}-{date}';
+ $this->dateFormat = 'Y-m-d';
+
+ parent::__construct($this->getTimedFilename(), $level, $bubble, $filePermission, $useLocking);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function close()
+ {
+ parent::close();
+
+ if (true === $this->mustRotate) {
+ $this->rotate();
+ }
+ }
+
+ public function setFilenameFormat($filenameFormat, $dateFormat)
+ {
+ if (!preg_match('{^Y(([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) {
+ trigger_error(
+ 'Invalid date format - format must be one of '.
+ 'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '.
+ 'or RotatingFileHandler::FILE_PER_YEAR ("Y"), or you can set one of the '.
+ 'date formats using slashes, underscores and/or dots instead of dashes.',
+ E_USER_DEPRECATED
+ );
+ }
+ if (substr_count($filenameFormat, '{date}') === 0) {
+ trigger_error(
+ 'Invalid filename format - format should contain at least `{date}`, because otherwise rotating is impossible.',
+ E_USER_DEPRECATED
+ );
+ }
+ $this->filenameFormat = $filenameFormat;
+ $this->dateFormat = $dateFormat;
+ $this->url = $this->getTimedFilename();
+ $this->close();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function write(array $record)
+ {
+ // on the first record written, if the log is new, we should rotate (once per day)
+ if (null === $this->mustRotate) {
+ $this->mustRotate = !file_exists($this->url);
+ }
+
+ if ($this->nextRotation < $record['datetime']) {
+ $this->mustRotate = true;
+ $this->close();
+ }
+
+ parent::write($record);
+ }
+
+ /**
+ * Rotates the files.
+ */
+ protected function rotate()
+ {
+ // update filename
+ $this->url = $this->getTimedFilename();
+ $this->nextRotation = new \DateTime('tomorrow');
+
+ // skip GC of old logs if files are unlimited
+ if (0 === $this->maxFiles) {
+ return;
+ }
+
+ $logFiles = glob($this->getGlobPattern());
+ if ($this->maxFiles >= count($logFiles)) {
+ // no files to remove
+ return;
+ }
+
+ // Sorting the files by name to remove the older ones
+ usort($logFiles, function ($a, $b) {
+ return strcmp($b, $a);
+ });
+
+ foreach (array_slice($logFiles, $this->maxFiles) as $file) {
+ if (is_writable($file)) {
+ // suppress errors here as unlink() might fail if two processes
+ // are cleaning up/rotating at the same time
+ set_error_handler(function ($errno, $errstr, $errfile, $errline) {});
+ unlink($file);
+ restore_error_handler();
+ }
+ }
+
+ $this->mustRotate = false;
+ }
+
+ protected function getTimedFilename()
+ {
+ $fileInfo = pathinfo($this->filename);
+ $timedFilename = str_replace(
+ array('{filename}', '{date}'),
+ array($fileInfo['filename'], date($this->dateFormat)),
+ $fileInfo['dirname'] . '/' . $this->filenameFormat
+ );
+
+ if (!empty($fileInfo['extension'])) {
+ $timedFilename .= '.'.$fileInfo['extension'];
+ }
+
+ return $timedFilename;
+ }
+
+ protected function getGlobPattern()
+ {
+ $fileInfo = pathinfo($this->filename);
+ $glob = str_replace(
+ array('{filename}', '{date}'),
+ array($fileInfo['filename'], '*'),
+ $fileInfo['dirname'] . '/' . $this->filenameFormat
+ );
+ if (!empty($fileInfo['extension'])) {
+ $glob .= '.'.$fileInfo['extension'];
+ }
+
+ return $glob;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php
new file mode 100644
index 0000000..9509ae3
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php
@@ -0,0 +1,82 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+/**
+ * Sampling handler
+ *
+ * A sampled event stream can be useful for logging high frequency events in
+ * a production environment where you only need an idea of what is happening
+ * and are not concerned with capturing every occurrence. Since the decision to
+ * handle or not handle a particular event is determined randomly, the
+ * resulting sampled log is not guaranteed to contain 1/N of the events that
+ * occurred in the application, but based on the Law of large numbers, it will
+ * tend to be close to this ratio with a large number of attempts.
+ *
+ * @author Bryan Davis
+ * @author Kunal Mehta
+ */
+class SamplingHandler extends AbstractHandler
+{
+ /**
+ * @var callable|HandlerInterface $handler
+ */
+ protected $handler;
+
+ /**
+ * @var int $factor
+ */
+ protected $factor;
+
+ /**
+ * @param callable|HandlerInterface $handler Handler or factory callable($record, $fingersCrossedHandler).
+ * @param int $factor Sample factor
+ */
+ public function __construct($handler, $factor)
+ {
+ parent::__construct();
+ $this->handler = $handler;
+ $this->factor = $factor;
+
+ if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) {
+ throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object");
+ }
+ }
+
+ public function isHandling(array $record)
+ {
+ return $this->handler->isHandling($record);
+ }
+
+ public function handle(array $record)
+ {
+ if ($this->isHandling($record) && mt_rand(1, $this->factor) === 1) {
+ // The same logic as in FingersCrossedHandler
+ if (!$this->handler instanceof HandlerInterface) {
+ $this->handler = call_user_func($this->handler, $record, $this);
+ if (!$this->handler instanceof HandlerInterface) {
+ throw new \RuntimeException("The factory callable should return a HandlerInterface");
+ }
+ }
+
+ if ($this->processors) {
+ foreach ($this->processors as $processor) {
+ $record = call_user_func($processor, $record);
+ }
+ }
+
+ $this->handler->handle($record);
+ }
+
+ return false === $this->bubble;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php b/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php
new file mode 100644
index 0000000..38bc838
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php
@@ -0,0 +1,294 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler\Slack;
+
+use Monolog\Logger;
+use Monolog\Formatter\NormalizerFormatter;
+use Monolog\Formatter\FormatterInterface;
+
+/**
+ * Slack record utility helping to log to Slack webhooks or API.
+ *
+ * @author Greg Kedzierski
+ * @author Haralan Dobrev
+ * @see https://api.slack.com/incoming-webhooks
+ * @see https://api.slack.com/docs/message-attachments
+ */
+class SlackRecord
+{
+ const COLOR_DANGER = 'danger';
+
+ const COLOR_WARNING = 'warning';
+
+ const COLOR_GOOD = 'good';
+
+ const COLOR_DEFAULT = '#e3e4e6';
+
+ /**
+ * Slack channel (encoded ID or name)
+ * @var string|null
+ */
+ private $channel;
+
+ /**
+ * Name of a bot
+ * @var string|null
+ */
+ private $username;
+
+ /**
+ * User icon e.g. 'ghost', 'http://example.com/user.png'
+ * @var string
+ */
+ private $userIcon;
+
+ /**
+ * Whether the message should be added to Slack as attachment (plain text otherwise)
+ * @var bool
+ */
+ private $useAttachment;
+
+ /**
+ * Whether the the context/extra messages added to Slack as attachments are in a short style
+ * @var bool
+ */
+ private $useShortAttachment;
+
+ /**
+ * Whether the attachment should include context and extra data
+ * @var bool
+ */
+ private $includeContextAndExtra;
+
+ /**
+ * Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2']
+ * @var array
+ */
+ private $excludeFields;
+
+ /**
+ * @var FormatterInterface
+ */
+ private $formatter;
+
+ /**
+ * @var NormalizerFormatter
+ */
+ private $normalizerFormatter;
+
+ public function __construct($channel = null, $username = null, $useAttachment = true, $userIcon = null, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array(), FormatterInterface $formatter = null)
+ {
+ $this->channel = $channel;
+ $this->username = $username;
+ $this->userIcon = trim($userIcon, ':');
+ $this->useAttachment = $useAttachment;
+ $this->useShortAttachment = $useShortAttachment;
+ $this->includeContextAndExtra = $includeContextAndExtra;
+ $this->excludeFields = $excludeFields;
+ $this->formatter = $formatter;
+
+ if ($this->includeContextAndExtra) {
+ $this->normalizerFormatter = new NormalizerFormatter();
+ }
+ }
+
+ public function getSlackData(array $record)
+ {
+ $dataArray = array();
+ $record = $this->excludeFields($record);
+
+ if ($this->username) {
+ $dataArray['username'] = $this->username;
+ }
+
+ if ($this->channel) {
+ $dataArray['channel'] = $this->channel;
+ }
+
+ if ($this->formatter && !$this->useAttachment) {
+ $message = $this->formatter->format($record);
+ } else {
+ $message = $record['message'];
+ }
+
+ if ($this->useAttachment) {
+ $attachment = array(
+ 'fallback' => $message,
+ 'text' => $message,
+ 'color' => $this->getAttachmentColor($record['level']),
+ 'fields' => array(),
+ 'mrkdwn_in' => array('fields'),
+ 'ts' => $record['datetime']->getTimestamp()
+ );
+
+ if ($this->useShortAttachment) {
+ $attachment['title'] = $record['level_name'];
+ } else {
+ $attachment['title'] = 'Message';
+ $attachment['fields'][] = $this->generateAttachmentField('Level', $record['level_name']);
+ }
+
+
+ if ($this->includeContextAndExtra) {
+ foreach (array('extra', 'context') as $key) {
+ if (empty($record[$key])) {
+ continue;
+ }
+
+ if ($this->useShortAttachment) {
+ $attachment['fields'][] = $this->generateAttachmentField(
+ ucfirst($key),
+ $record[$key]
+ );
+ } else {
+ // Add all extra fields as individual fields in attachment
+ $attachment['fields'] = array_merge(
+ $attachment['fields'],
+ $this->generateAttachmentFields($record[$key])
+ );
+ }
+ }
+ }
+
+ $dataArray['attachments'] = array($attachment);
+ } else {
+ $dataArray['text'] = $message;
+ }
+
+ if ($this->userIcon) {
+ if (filter_var($this->userIcon, FILTER_VALIDATE_URL)) {
+ $dataArray['icon_url'] = $this->userIcon;
+ } else {
+ $dataArray['icon_emoji'] = ":{$this->userIcon}:";
+ }
+ }
+
+ return $dataArray;
+ }
+
+ /**
+ * Returned a Slack message attachment color associated with
+ * provided level.
+ *
+ * @param int $level
+ * @return string
+ */
+ public function getAttachmentColor($level)
+ {
+ switch (true) {
+ case $level >= Logger::ERROR:
+ return self::COLOR_DANGER;
+ case $level >= Logger::WARNING:
+ return self::COLOR_WARNING;
+ case $level >= Logger::INFO:
+ return self::COLOR_GOOD;
+ default:
+ return self::COLOR_DEFAULT;
+ }
+ }
+
+ /**
+ * Stringifies an array of key/value pairs to be used in attachment fields
+ *
+ * @param array $fields
+ *
+ * @return string
+ */
+ public function stringify($fields)
+ {
+ $normalized = $this->normalizerFormatter->format($fields);
+ $prettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128;
+
+ $hasSecondDimension = count(array_filter($normalized, 'is_array'));
+ $hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric'));
+
+ return $hasSecondDimension || $hasNonNumericKeys
+ ? json_encode($normalized, $prettyPrintFlag)
+ : json_encode($normalized);
+ }
+
+ /**
+ * Sets the formatter
+ *
+ * @param FormatterInterface $formatter
+ */
+ public function setFormatter(FormatterInterface $formatter)
+ {
+ $this->formatter = $formatter;
+ }
+
+ /**
+ * Generates attachment field
+ *
+ * @param string $title
+ * @param string|array $value\
+ *
+ * @return array
+ */
+ private function generateAttachmentField($title, $value)
+ {
+ $value = is_array($value)
+ ? sprintf('```%s```', $this->stringify($value))
+ : $value;
+
+ return array(
+ 'title' => $title,
+ 'value' => $value,
+ 'short' => false
+ );
+ }
+
+ /**
+ * Generates a collection of attachment fields from array
+ *
+ * @param array $data
+ *
+ * @return array
+ */
+ private function generateAttachmentFields(array $data)
+ {
+ $fields = array();
+ foreach ($data as $key => $value) {
+ $fields[] = $this->generateAttachmentField($key, $value);
+ }
+
+ return $fields;
+ }
+
+ /**
+ * Get a copy of record with fields excluded according to $this->excludeFields
+ *
+ * @param array $record
+ *
+ * @return array
+ */
+ private function excludeFields(array $record)
+ {
+ foreach ($this->excludeFields as $field) {
+ $keys = explode('.', $field);
+ $node = &$record;
+ $lastKey = end($keys);
+ foreach ($keys as $key) {
+ if (!isset($node[$key])) {
+ break;
+ }
+ if ($lastKey === $key) {
+ unset($node[$key]);
+ break;
+ }
+ $node = &$node[$key];
+ }
+ }
+
+ return $record;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php
new file mode 100644
index 0000000..3ac4d83
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php
@@ -0,0 +1,215 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\FormatterInterface;
+use Monolog\Logger;
+use Monolog\Handler\Slack\SlackRecord;
+
+/**
+ * Sends notifications through Slack API
+ *
+ * @author Greg Kedzierski
+ * @see https://api.slack.com/
+ */
+class SlackHandler extends SocketHandler
+{
+ /**
+ * Slack API token
+ * @var string
+ */
+ private $token;
+
+ /**
+ * Instance of the SlackRecord util class preparing data for Slack API.
+ * @var SlackRecord
+ */
+ private $slackRecord;
+
+ /**
+ * @param string $token Slack API token
+ * @param string $channel Slack channel (encoded ID or name)
+ * @param string|null $username Name of a bot
+ * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise)
+ * @param string|null $iconEmoji The emoji name to use (or null)
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style
+ * @param bool $includeContextAndExtra Whether the attachment should include context and extra data
+ * @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2']
+ * @throws MissingExtensionException If no OpenSSL PHP extension configured
+ */
+ public function __construct($token, $channel, $username = null, $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array())
+ {
+ if (!extension_loaded('openssl')) {
+ throw new MissingExtensionException('The OpenSSL PHP extension is required to use the SlackHandler');
+ }
+
+ parent::__construct('ssl://slack.com:443', $level, $bubble);
+
+ $this->slackRecord = new SlackRecord(
+ $channel,
+ $username,
+ $useAttachment,
+ $iconEmoji,
+ $useShortAttachment,
+ $includeContextAndExtra,
+ $excludeFields,
+ $this->formatter
+ );
+
+ $this->token = $token;
+ }
+
+ public function getSlackRecord()
+ {
+ return $this->slackRecord;
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @param array $record
+ * @return string
+ */
+ protected function generateDataStream($record)
+ {
+ $content = $this->buildContent($record);
+
+ return $this->buildHeader($content) . $content;
+ }
+
+ /**
+ * Builds the body of API call
+ *
+ * @param array $record
+ * @return string
+ */
+ private function buildContent($record)
+ {
+ $dataArray = $this->prepareContentData($record);
+
+ return http_build_query($dataArray);
+ }
+
+ /**
+ * Prepares content data
+ *
+ * @param array $record
+ * @return array
+ */
+ protected function prepareContentData($record)
+ {
+ $dataArray = $this->slackRecord->getSlackData($record);
+ $dataArray['token'] = $this->token;
+
+ if (!empty($dataArray['attachments'])) {
+ $dataArray['attachments'] = json_encode($dataArray['attachments']);
+ }
+
+ return $dataArray;
+ }
+
+ /**
+ * Builds the header of the API Call
+ *
+ * @param string $content
+ * @return string
+ */
+ private function buildHeader($content)
+ {
+ $header = "POST /api/chat.postMessage HTTP/1.1\r\n";
+ $header .= "Host: slack.com\r\n";
+ $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
+ $header .= "Content-Length: " . strlen($content) . "\r\n";
+ $header .= "\r\n";
+
+ return $header;
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @param array $record
+ */
+ protected function write(array $record)
+ {
+ parent::write($record);
+ $this->finalizeWrite();
+ }
+
+ /**
+ * Finalizes the request by reading some bytes and then closing the socket
+ *
+ * If we do not read some but close the socket too early, slack sometimes
+ * drops the request entirely.
+ */
+ protected function finalizeWrite()
+ {
+ $res = $this->getResource();
+ if (is_resource($res)) {
+ @fread($res, 2048);
+ }
+ $this->closeSocket();
+ }
+
+ /**
+ * Returned a Slack message attachment color associated with
+ * provided level.
+ *
+ * @param int $level
+ * @return string
+ * @deprecated Use underlying SlackRecord instead
+ */
+ protected function getAttachmentColor($level)
+ {
+ trigger_error(
+ 'SlackHandler::getAttachmentColor() is deprecated. Use underlying SlackRecord instead.',
+ E_USER_DEPRECATED
+ );
+
+ return $this->slackRecord->getAttachmentColor($level);
+ }
+
+ /**
+ * Stringifies an array of key/value pairs to be used in attachment fields
+ *
+ * @param array $fields
+ * @return string
+ * @deprecated Use underlying SlackRecord instead
+ */
+ protected function stringify($fields)
+ {
+ trigger_error(
+ 'SlackHandler::stringify() is deprecated. Use underlying SlackRecord instead.',
+ E_USER_DEPRECATED
+ );
+
+ return $this->slackRecord->stringify($fields);
+ }
+
+ public function setFormatter(FormatterInterface $formatter)
+ {
+ parent::setFormatter($formatter);
+ $this->slackRecord->setFormatter($formatter);
+
+ return $this;
+ }
+
+ public function getFormatter()
+ {
+ $formatter = parent::getFormatter();
+ $this->slackRecord->setFormatter($formatter);
+
+ return $formatter;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php
new file mode 100644
index 0000000..9a1bbb4
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php
@@ -0,0 +1,115 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\FormatterInterface;
+use Monolog\Logger;
+use Monolog\Handler\Slack\SlackRecord;
+
+/**
+ * Sends notifications through Slack Webhooks
+ *
+ * @author Haralan Dobrev
+ * @see https://api.slack.com/incoming-webhooks
+ */
+class SlackWebhookHandler extends AbstractProcessingHandler
+{
+ /**
+ * Slack Webhook token
+ * @var string
+ */
+ private $webhookUrl;
+
+ /**
+ * Instance of the SlackRecord util class preparing data for Slack API.
+ * @var SlackRecord
+ */
+ private $slackRecord;
+
+ /**
+ * @param string $webhookUrl Slack Webhook URL
+ * @param string|null $channel Slack channel (encoded ID or name)
+ * @param string|null $username Name of a bot
+ * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise)
+ * @param string|null $iconEmoji The emoji name to use (or null)
+ * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style
+ * @param bool $includeContextAndExtra Whether the attachment should include context and extra data
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2']
+ */
+ public function __construct($webhookUrl, $channel = null, $username = null, $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeContextAndExtra = false, $level = Logger::CRITICAL, $bubble = true, array $excludeFields = array())
+ {
+ parent::__construct($level, $bubble);
+
+ $this->webhookUrl = $webhookUrl;
+
+ $this->slackRecord = new SlackRecord(
+ $channel,
+ $username,
+ $useAttachment,
+ $iconEmoji,
+ $useShortAttachment,
+ $includeContextAndExtra,
+ $excludeFields,
+ $this->formatter
+ );
+ }
+
+ public function getSlackRecord()
+ {
+ return $this->slackRecord;
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @param array $record
+ */
+ protected function write(array $record)
+ {
+ $postData = $this->slackRecord->getSlackData($record);
+ $postString = json_encode($postData);
+
+ $ch = curl_init();
+ $options = array(
+ CURLOPT_URL => $this->webhookUrl,
+ CURLOPT_POST => true,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_HTTPHEADER => array('Content-type: application/json'),
+ CURLOPT_POSTFIELDS => $postString
+ );
+ if (defined('CURLOPT_SAFE_UPLOAD')) {
+ $options[CURLOPT_SAFE_UPLOAD] = true;
+ }
+
+ curl_setopt_array($ch, $options);
+
+ Curl\Util::execute($ch);
+ }
+
+ public function setFormatter(FormatterInterface $formatter)
+ {
+ parent::setFormatter($formatter);
+ $this->slackRecord->setFormatter($formatter);
+
+ return $this;
+ }
+
+ public function getFormatter()
+ {
+ $formatter = parent::getFormatter();
+ $this->slackRecord->setFormatter($formatter);
+
+ return $formatter;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php
new file mode 100644
index 0000000..baead52
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php
@@ -0,0 +1,80 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * Sends notifications through Slack's Slackbot
+ *
+ * @author Haralan Dobrev
+ * @see https://slack.com/apps/A0F81R8ET-slackbot
+ */
+class SlackbotHandler extends AbstractProcessingHandler
+{
+ /**
+ * The slug of the Slack team
+ * @var string
+ */
+ private $slackTeam;
+
+ /**
+ * Slackbot token
+ * @var string
+ */
+ private $token;
+
+ /**
+ * Slack channel name
+ * @var string
+ */
+ private $channel;
+
+ /**
+ * @param string $slackTeam Slack team slug
+ * @param string $token Slackbot token
+ * @param string $channel Slack channel (encoded ID or name)
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct($slackTeam, $token, $channel, $level = Logger::CRITICAL, $bubble = true)
+ {
+ parent::__construct($level, $bubble);
+
+ $this->slackTeam = $slackTeam;
+ $this->token = $token;
+ $this->channel = $channel;
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @param array $record
+ */
+ protected function write(array $record)
+ {
+ $slackbotUrl = sprintf(
+ 'https://%s.slack.com/services/hooks/slackbot?token=%s&channel=%s',
+ $this->slackTeam,
+ $this->token,
+ $this->channel
+ );
+
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $slackbotUrl);
+ curl_setopt($ch, CURLOPT_POST, true);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $record['message']);
+
+ Curl\Util::execute($ch);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php
new file mode 100644
index 0000000..7a61bf4
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php
@@ -0,0 +1,346 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * Stores to any socket - uses fsockopen() or pfsockopen().
+ *
+ * @author Pablo de Leon Belloc
+ * @see http://php.net/manual/en/function.fsockopen.php
+ */
+class SocketHandler extends AbstractProcessingHandler
+{
+ private $connectionString;
+ private $connectionTimeout;
+ private $resource;
+ private $timeout = 0;
+ private $writingTimeout = 10;
+ private $lastSentBytes = null;
+ private $persistent = false;
+ private $errno;
+ private $errstr;
+ private $lastWritingAt;
+
+ /**
+ * @param string $connectionString Socket connection string
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true)
+ {
+ parent::__construct($level, $bubble);
+ $this->connectionString = $connectionString;
+ $this->connectionTimeout = (float) ini_get('default_socket_timeout');
+ }
+
+ /**
+ * Connect (if necessary) and write to the socket
+ *
+ * @param array $record
+ *
+ * @throws \UnexpectedValueException
+ * @throws \RuntimeException
+ */
+ protected function write(array $record)
+ {
+ $this->connectIfNotConnected();
+ $data = $this->generateDataStream($record);
+ $this->writeToSocket($data);
+ }
+
+ /**
+ * We will not close a PersistentSocket instance so it can be reused in other requests.
+ */
+ public function close()
+ {
+ if (!$this->isPersistent()) {
+ $this->closeSocket();
+ }
+ }
+
+ /**
+ * Close socket, if open
+ */
+ public function closeSocket()
+ {
+ if (is_resource($this->resource)) {
+ fclose($this->resource);
+ $this->resource = null;
+ }
+ }
+
+ /**
+ * Set socket connection to nbe persistent. It only has effect before the connection is initiated.
+ *
+ * @param bool $persistent
+ */
+ public function setPersistent($persistent)
+ {
+ $this->persistent = (boolean) $persistent;
+ }
+
+ /**
+ * Set connection timeout. Only has effect before we connect.
+ *
+ * @param float $seconds
+ *
+ * @see http://php.net/manual/en/function.fsockopen.php
+ */
+ public function setConnectionTimeout($seconds)
+ {
+ $this->validateTimeout($seconds);
+ $this->connectionTimeout = (float) $seconds;
+ }
+
+ /**
+ * Set write timeout. Only has effect before we connect.
+ *
+ * @param float $seconds
+ *
+ * @see http://php.net/manual/en/function.stream-set-timeout.php
+ */
+ public function setTimeout($seconds)
+ {
+ $this->validateTimeout($seconds);
+ $this->timeout = (float) $seconds;
+ }
+
+ /**
+ * Set writing timeout. Only has effect during connection in the writing cycle.
+ *
+ * @param float $seconds 0 for no timeout
+ */
+ public function setWritingTimeout($seconds)
+ {
+ $this->validateTimeout($seconds);
+ $this->writingTimeout = (float) $seconds;
+ }
+
+ /**
+ * Get current connection string
+ *
+ * @return string
+ */
+ public function getConnectionString()
+ {
+ return $this->connectionString;
+ }
+
+ /**
+ * Get persistent setting
+ *
+ * @return bool
+ */
+ public function isPersistent()
+ {
+ return $this->persistent;
+ }
+
+ /**
+ * Get current connection timeout setting
+ *
+ * @return float
+ */
+ public function getConnectionTimeout()
+ {
+ return $this->connectionTimeout;
+ }
+
+ /**
+ * Get current in-transfer timeout
+ *
+ * @return float
+ */
+ public function getTimeout()
+ {
+ return $this->timeout;
+ }
+
+ /**
+ * Get current local writing timeout
+ *
+ * @return float
+ */
+ public function getWritingTimeout()
+ {
+ return $this->writingTimeout;
+ }
+
+ /**
+ * Check to see if the socket is currently available.
+ *
+ * UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details.
+ *
+ * @return bool
+ */
+ public function isConnected()
+ {
+ return is_resource($this->resource)
+ && !feof($this->resource); // on TCP - other party can close connection.
+ }
+
+ /**
+ * Wrapper to allow mocking
+ */
+ protected function pfsockopen()
+ {
+ return @pfsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout);
+ }
+
+ /**
+ * Wrapper to allow mocking
+ */
+ protected function fsockopen()
+ {
+ return @fsockopen($this->connectionString, -1, $this->errno, $this->errstr, $this->connectionTimeout);
+ }
+
+ /**
+ * Wrapper to allow mocking
+ *
+ * @see http://php.net/manual/en/function.stream-set-timeout.php
+ */
+ protected function streamSetTimeout()
+ {
+ $seconds = floor($this->timeout);
+ $microseconds = round(($this->timeout - $seconds) * 1e6);
+
+ return stream_set_timeout($this->resource, $seconds, $microseconds);
+ }
+
+ /**
+ * Wrapper to allow mocking
+ */
+ protected function fwrite($data)
+ {
+ return @fwrite($this->resource, $data);
+ }
+
+ /**
+ * Wrapper to allow mocking
+ */
+ protected function streamGetMetadata()
+ {
+ return stream_get_meta_data($this->resource);
+ }
+
+ private function validateTimeout($value)
+ {
+ $ok = filter_var($value, FILTER_VALIDATE_FLOAT);
+ if ($ok === false || $value < 0) {
+ throw new \InvalidArgumentException("Timeout must be 0 or a positive float (got $value)");
+ }
+ }
+
+ private function connectIfNotConnected()
+ {
+ if ($this->isConnected()) {
+ return;
+ }
+ $this->connect();
+ }
+
+ protected function generateDataStream($record)
+ {
+ return (string) $record['formatted'];
+ }
+
+ /**
+ * @return resource|null
+ */
+ protected function getResource()
+ {
+ return $this->resource;
+ }
+
+ private function connect()
+ {
+ $this->createSocketResource();
+ $this->setSocketTimeout();
+ }
+
+ private function createSocketResource()
+ {
+ if ($this->isPersistent()) {
+ $resource = $this->pfsockopen();
+ } else {
+ $resource = $this->fsockopen();
+ }
+ if (!$resource) {
+ throw new \UnexpectedValueException("Failed connecting to $this->connectionString ($this->errno: $this->errstr)");
+ }
+ $this->resource = $resource;
+ }
+
+ private function setSocketTimeout()
+ {
+ if (!$this->streamSetTimeout()) {
+ throw new \UnexpectedValueException("Failed setting timeout with stream_set_timeout()");
+ }
+ }
+
+ private function writeToSocket($data)
+ {
+ $length = strlen($data);
+ $sent = 0;
+ $this->lastSentBytes = $sent;
+ while ($this->isConnected() && $sent < $length) {
+ if (0 == $sent) {
+ $chunk = $this->fwrite($data);
+ } else {
+ $chunk = $this->fwrite(substr($data, $sent));
+ }
+ if ($chunk === false) {
+ throw new \RuntimeException("Could not write to socket");
+ }
+ $sent += $chunk;
+ $socketInfo = $this->streamGetMetadata();
+ if ($socketInfo['timed_out']) {
+ throw new \RuntimeException("Write timed-out");
+ }
+
+ if ($this->writingIsTimedOut($sent)) {
+ throw new \RuntimeException("Write timed-out, no data sent for `{$this->writingTimeout}` seconds, probably we got disconnected (sent $sent of $length)");
+ }
+ }
+ if (!$this->isConnected() && $sent < $length) {
+ throw new \RuntimeException("End-of-file reached, probably we got disconnected (sent $sent of $length)");
+ }
+ }
+
+ private function writingIsTimedOut($sent)
+ {
+ $writingTimeout = (int) floor($this->writingTimeout);
+ if (0 === $writingTimeout) {
+ return false;
+ }
+
+ if ($sent !== $this->lastSentBytes) {
+ $this->lastWritingAt = time();
+ $this->lastSentBytes = $sent;
+
+ return false;
+ } else {
+ usleep(100);
+ }
+
+ if ((time() - $this->lastWritingAt) >= $writingTimeout) {
+ $this->closeSocket();
+
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php
new file mode 100644
index 0000000..09a1573
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php
@@ -0,0 +1,176 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * Stores to any stream resource
+ *
+ * Can be used to store into php://stderr, remote and local files, etc.
+ *
+ * @author Jordi Boggiano
+ */
+class StreamHandler extends AbstractProcessingHandler
+{
+ protected $stream;
+ protected $url;
+ private $errorMessage;
+ protected $filePermission;
+ protected $useLocking;
+ private $dirCreated;
+
+ /**
+ * @param resource|string $stream
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write)
+ * @param Boolean $useLocking Try to lock log file before doing any writes
+ *
+ * @throws \Exception If a missing directory is not buildable
+ * @throws \InvalidArgumentException If stream is not a resource or string
+ */
+ public function __construct($stream, $level = Logger::DEBUG, $bubble = true, $filePermission = null, $useLocking = false)
+ {
+ parent::__construct($level, $bubble);
+ if (is_resource($stream)) {
+ $this->stream = $stream;
+ } elseif (is_string($stream)) {
+ $this->url = $stream;
+ } else {
+ throw new \InvalidArgumentException('A stream must either be a resource or a string.');
+ }
+
+ $this->filePermission = $filePermission;
+ $this->useLocking = $useLocking;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function close()
+ {
+ if ($this->url && is_resource($this->stream)) {
+ fclose($this->stream);
+ }
+ $this->stream = null;
+ }
+
+ /**
+ * Return the currently active stream if it is open
+ *
+ * @return resource|null
+ */
+ public function getStream()
+ {
+ return $this->stream;
+ }
+
+ /**
+ * Return the stream URL if it was configured with a URL and not an active resource
+ *
+ * @return string|null
+ */
+ public function getUrl()
+ {
+ return $this->url;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function write(array $record)
+ {
+ if (!is_resource($this->stream)) {
+ if (null === $this->url || '' === $this->url) {
+ throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
+ }
+ $this->createDir();
+ $this->errorMessage = null;
+ set_error_handler(array($this, 'customErrorHandler'));
+ $this->stream = fopen($this->url, 'a');
+ if ($this->filePermission !== null) {
+ @chmod($this->url, $this->filePermission);
+ }
+ restore_error_handler();
+ if (!is_resource($this->stream)) {
+ $this->stream = null;
+ throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: '.$this->errorMessage, $this->url));
+ }
+ }
+
+ if ($this->useLocking) {
+ // ignoring errors here, there's not much we can do about them
+ flock($this->stream, LOCK_EX);
+ }
+
+ $this->streamWrite($this->stream, $record);
+
+ if ($this->useLocking) {
+ flock($this->stream, LOCK_UN);
+ }
+ }
+
+ /**
+ * Write to stream
+ * @param resource $stream
+ * @param array $record
+ */
+ protected function streamWrite($stream, array $record)
+ {
+ fwrite($stream, (string) $record['formatted']);
+ }
+
+ private function customErrorHandler($code, $msg)
+ {
+ $this->errorMessage = preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg);
+ }
+
+ /**
+ * @param string $stream
+ *
+ * @return null|string
+ */
+ private function getDirFromStream($stream)
+ {
+ $pos = strpos($stream, '://');
+ if ($pos === false) {
+ return dirname($stream);
+ }
+
+ if ('file://' === substr($stream, 0, 7)) {
+ return dirname(substr($stream, 7));
+ }
+
+ return;
+ }
+
+ private function createDir()
+ {
+ // Do not try to create dir if it has already been tried.
+ if ($this->dirCreated) {
+ return;
+ }
+
+ $dir = $this->getDirFromStream($this->url);
+ if (null !== $dir && !is_dir($dir)) {
+ $this->errorMessage = null;
+ set_error_handler(array($this, 'customErrorHandler'));
+ $status = mkdir($dir, 0777, true);
+ restore_error_handler();
+ if (false === $status) {
+ throw new \UnexpectedValueException(sprintf('There is no existing directory at "%s" and its not buildable: '.$this->errorMessage, $dir));
+ }
+ }
+ $this->dirCreated = true;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php
new file mode 100644
index 0000000..72f44a5
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php
@@ -0,0 +1,99 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\Formatter\LineFormatter;
+use Swift;
+
+/**
+ * SwiftMailerHandler uses Swift_Mailer to send the emails
+ *
+ * @author Gyula Sallai
+ */
+class SwiftMailerHandler extends MailHandler
+{
+ protected $mailer;
+ private $messageTemplate;
+
+ /**
+ * @param \Swift_Mailer $mailer The mailer to use
+ * @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ */
+ public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true)
+ {
+ parent::__construct($level, $bubble);
+
+ $this->mailer = $mailer;
+ $this->messageTemplate = $message;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function send($content, array $records)
+ {
+ $this->mailer->send($this->buildMessage($content, $records));
+ }
+
+ /**
+ * Creates instance of Swift_Message to be sent
+ *
+ * @param string $content formatted email body to be sent
+ * @param array $records Log records that formed the content
+ * @return \Swift_Message
+ */
+ protected function buildMessage($content, array $records)
+ {
+ $message = null;
+ if ($this->messageTemplate instanceof \Swift_Message) {
+ $message = clone $this->messageTemplate;
+ $message->generateId();
+ } elseif (is_callable($this->messageTemplate)) {
+ $message = call_user_func($this->messageTemplate, $content, $records);
+ }
+
+ if (!$message instanceof \Swift_Message) {
+ throw new \InvalidArgumentException('Could not resolve message as instance of Swift_Message or a callable returning it');
+ }
+
+ if ($records) {
+ $subjectFormatter = new LineFormatter($message->getSubject());
+ $message->setSubject($subjectFormatter->format($this->getHighestRecord($records)));
+ }
+
+ $message->setBody($content);
+ if (version_compare(Swift::VERSION, '6.0.0', '>=')) {
+ $message->setDate(new \DateTimeImmutable());
+ } else {
+ $message->setDate(time());
+ }
+
+ return $message;
+ }
+
+ /**
+ * BC getter, to be removed in 2.0
+ */
+ public function __get($name)
+ {
+ if ($name === 'message') {
+ trigger_error('SwiftMailerHandler->message is deprecated, use ->buildMessage() instead to retrieve the message', E_USER_DEPRECATED);
+
+ return $this->buildMessage(null, array());
+ }
+
+ throw new \InvalidArgumentException('Invalid property '.$name);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php
new file mode 100644
index 0000000..376bc3b
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php
@@ -0,0 +1,67 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+/**
+ * Logs to syslog service.
+ *
+ * usage example:
+ *
+ * $log = new Logger('application');
+ * $syslog = new SyslogHandler('myfacility', 'local6');
+ * $formatter = new LineFormatter("%channel%.%level_name%: %message% %extra%");
+ * $syslog->setFormatter($formatter);
+ * $log->pushHandler($syslog);
+ *
+ * @author Sven Paulus
+ */
+class SyslogHandler extends AbstractSyslogHandler
+{
+ protected $ident;
+ protected $logopts;
+
+ /**
+ * @param string $ident
+ * @param mixed $facility
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param int $logopts Option flags for the openlog() call, defaults to LOG_PID
+ */
+ public function __construct($ident, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $logopts = LOG_PID)
+ {
+ parent::__construct($facility, $level, $bubble);
+
+ $this->ident = $ident;
+ $this->logopts = $logopts;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function close()
+ {
+ closelog();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function write(array $record)
+ {
+ if (!openlog($this->ident, $this->logopts, $this->facility)) {
+ throw new \LogicException('Can\'t open syslog for ident "'.$this->ident.'" and facility "'.$this->facility.'"');
+ }
+ syslog($this->logLevels[$record['level']], (string) $record['formatted']);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php
new file mode 100644
index 0000000..3bff085
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php
@@ -0,0 +1,56 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler\SyslogUdp;
+
+class UdpSocket
+{
+ const DATAGRAM_MAX_LENGTH = 65023;
+
+ protected $ip;
+ protected $port;
+ protected $socket;
+
+ public function __construct($ip, $port = 514)
+ {
+ $this->ip = $ip;
+ $this->port = $port;
+ $this->socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
+ }
+
+ public function write($line, $header = "")
+ {
+ $this->send($this->assembleMessage($line, $header));
+ }
+
+ public function close()
+ {
+ if (is_resource($this->socket)) {
+ socket_close($this->socket);
+ $this->socket = null;
+ }
+ }
+
+ protected function send($chunk)
+ {
+ if (!is_resource($this->socket)) {
+ throw new \LogicException('The UdpSocket to '.$this->ip.':'.$this->port.' has been closed and can not be written to anymore');
+ }
+ socket_sendto($this->socket, $chunk, strlen($chunk), $flags = 0, $this->ip, $this->port);
+ }
+
+ protected function assembleMessage($line, $header)
+ {
+ $chunkSize = self::DATAGRAM_MAX_LENGTH - strlen($header);
+
+ return $header . substr($line, 0, $chunkSize);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php
new file mode 100644
index 0000000..4718711
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php
@@ -0,0 +1,103 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\Handler\SyslogUdp\UdpSocket;
+
+/**
+ * A Handler for logging to a remote syslogd server.
+ *
+ * @author Jesper Skovgaard Nielsen
+ */
+class SyslogUdpHandler extends AbstractSyslogHandler
+{
+ protected $socket;
+ protected $ident;
+
+ /**
+ * @param string $host
+ * @param int $port
+ * @param mixed $facility
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param string $ident Program name or tag for each log message.
+ */
+ public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $ident = 'php')
+ {
+ parent::__construct($facility, $level, $bubble);
+
+ $this->ident = $ident;
+
+ $this->socket = new UdpSocket($host, $port ?: 514);
+ }
+
+ protected function write(array $record)
+ {
+ $lines = $this->splitMessageIntoLines($record['formatted']);
+
+ $header = $this->makeCommonSyslogHeader($this->logLevels[$record['level']]);
+
+ foreach ($lines as $line) {
+ $this->socket->write($line, $header);
+ }
+ }
+
+ public function close()
+ {
+ $this->socket->close();
+ }
+
+ private function splitMessageIntoLines($message)
+ {
+ if (is_array($message)) {
+ $message = implode("\n", $message);
+ }
+
+ return preg_split('/$\R?^/m', $message, -1, PREG_SPLIT_NO_EMPTY);
+ }
+
+ /**
+ * Make common syslog header (see rfc5424)
+ */
+ protected function makeCommonSyslogHeader($severity)
+ {
+ $priority = $severity + $this->facility;
+
+ if (!$pid = getmypid()) {
+ $pid = '-';
+ }
+
+ if (!$hostname = gethostname()) {
+ $hostname = '-';
+ }
+
+ return "<$priority>1 " .
+ $this->getDateTime() . " " .
+ $hostname . " " .
+ $this->ident . " " .
+ $pid . " - - ";
+ }
+
+ protected function getDateTime()
+ {
+ return date(\DateTime::RFC3339);
+ }
+
+ /**
+ * Inject your own socket, mainly used for testing
+ */
+ public function setSocket($socket)
+ {
+ $this->socket = $socket;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php
new file mode 100644
index 0000000..e39cfc6
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php
@@ -0,0 +1,154 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+/**
+ * Used for testing purposes.
+ *
+ * It records all records and gives you access to them for verification.
+ *
+ * @author Jordi Boggiano
+ *
+ * @method bool hasEmergency($record)
+ * @method bool hasAlert($record)
+ * @method bool hasCritical($record)
+ * @method bool hasError($record)
+ * @method bool hasWarning($record)
+ * @method bool hasNotice($record)
+ * @method bool hasInfo($record)
+ * @method bool hasDebug($record)
+ *
+ * @method bool hasEmergencyRecords()
+ * @method bool hasAlertRecords()
+ * @method bool hasCriticalRecords()
+ * @method bool hasErrorRecords()
+ * @method bool hasWarningRecords()
+ * @method bool hasNoticeRecords()
+ * @method bool hasInfoRecords()
+ * @method bool hasDebugRecords()
+ *
+ * @method bool hasEmergencyThatContains($message)
+ * @method bool hasAlertThatContains($message)
+ * @method bool hasCriticalThatContains($message)
+ * @method bool hasErrorThatContains($message)
+ * @method bool hasWarningThatContains($message)
+ * @method bool hasNoticeThatContains($message)
+ * @method bool hasInfoThatContains($message)
+ * @method bool hasDebugThatContains($message)
+ *
+ * @method bool hasEmergencyThatMatches($message)
+ * @method bool hasAlertThatMatches($message)
+ * @method bool hasCriticalThatMatches($message)
+ * @method bool hasErrorThatMatches($message)
+ * @method bool hasWarningThatMatches($message)
+ * @method bool hasNoticeThatMatches($message)
+ * @method bool hasInfoThatMatches($message)
+ * @method bool hasDebugThatMatches($message)
+ *
+ * @method bool hasEmergencyThatPasses($message)
+ * @method bool hasAlertThatPasses($message)
+ * @method bool hasCriticalThatPasses($message)
+ * @method bool hasErrorThatPasses($message)
+ * @method bool hasWarningThatPasses($message)
+ * @method bool hasNoticeThatPasses($message)
+ * @method bool hasInfoThatPasses($message)
+ * @method bool hasDebugThatPasses($message)
+ */
+class TestHandler extends AbstractProcessingHandler
+{
+ protected $records = array();
+ protected $recordsByLevel = array();
+
+ public function getRecords()
+ {
+ return $this->records;
+ }
+
+ public function clear()
+ {
+ $this->records = array();
+ $this->recordsByLevel = array();
+ }
+
+ public function hasRecords($level)
+ {
+ return isset($this->recordsByLevel[$level]);
+ }
+
+ public function hasRecord($record, $level)
+ {
+ if (is_array($record)) {
+ $record = $record['message'];
+ }
+
+ return $this->hasRecordThatPasses(function ($rec) use ($record) {
+ return $rec['message'] === $record;
+ }, $level);
+ }
+
+ public function hasRecordThatContains($message, $level)
+ {
+ return $this->hasRecordThatPasses(function ($rec) use ($message) {
+ return strpos($rec['message'], $message) !== false;
+ }, $level);
+ }
+
+ public function hasRecordThatMatches($regex, $level)
+ {
+ return $this->hasRecordThatPasses(function ($rec) use ($regex) {
+ return preg_match($regex, $rec['message']) > 0;
+ }, $level);
+ }
+
+ public function hasRecordThatPasses($predicate, $level)
+ {
+ if (!is_callable($predicate)) {
+ throw new \InvalidArgumentException("Expected a callable for hasRecordThatSucceeds");
+ }
+
+ if (!isset($this->recordsByLevel[$level])) {
+ return false;
+ }
+
+ foreach ($this->recordsByLevel[$level] as $i => $rec) {
+ if (call_user_func($predicate, $rec, $i)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function write(array $record)
+ {
+ $this->recordsByLevel[$record['level']][] = $record;
+ $this->records[] = $record;
+ }
+
+ public function __call($method, $args)
+ {
+ if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
+ $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
+ $level = constant('Monolog\Logger::' . strtoupper($matches[2]));
+ if (method_exists($this, $genericMethod)) {
+ $args[] = $level;
+
+ return call_user_func_array(array($this, $genericMethod), $args);
+ }
+ }
+
+ throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php
new file mode 100644
index 0000000..2732ba3
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php
@@ -0,0 +1,61 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+/**
+ * Forwards records to multiple handlers suppressing failures of each handler
+ * and continuing through to give every handler a chance to succeed.
+ *
+ * @author Craig D'Amelio
+ */
+class WhatFailureGroupHandler extends GroupHandler
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function handle(array $record)
+ {
+ if ($this->processors) {
+ foreach ($this->processors as $processor) {
+ $record = call_user_func($processor, $record);
+ }
+ }
+
+ foreach ($this->handlers as $handler) {
+ try {
+ $handler->handle($record);
+ } catch (\Exception $e) {
+ // What failure?
+ } catch (\Throwable $e) {
+ // What failure?
+ }
+ }
+
+ return false === $this->bubble;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function handleBatch(array $records)
+ {
+ foreach ($this->handlers as $handler) {
+ try {
+ $handler->handleBatch($records);
+ } catch (\Exception $e) {
+ // What failure?
+ } catch (\Throwable $e) {
+ // What failure?
+ }
+ }
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php b/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php
new file mode 100644
index 0000000..f22cf21
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php
@@ -0,0 +1,95 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\NormalizerFormatter;
+use Monolog\Logger;
+
+/**
+ * Handler sending logs to Zend Monitor
+ *
+ * @author Christian Bergau
+ */
+class ZendMonitorHandler extends AbstractProcessingHandler
+{
+ /**
+ * Monolog level / ZendMonitor Custom Event priority map
+ *
+ * @var array
+ */
+ protected $levelMap = array(
+ Logger::DEBUG => 1,
+ Logger::INFO => 2,
+ Logger::NOTICE => 3,
+ Logger::WARNING => 4,
+ Logger::ERROR => 5,
+ Logger::CRITICAL => 6,
+ Logger::ALERT => 7,
+ Logger::EMERGENCY => 0,
+ );
+
+ /**
+ * Construct
+ *
+ * @param int $level
+ * @param bool $bubble
+ * @throws MissingExtensionException
+ */
+ public function __construct($level = Logger::DEBUG, $bubble = true)
+ {
+ if (!function_exists('zend_monitor_custom_event')) {
+ throw new MissingExtensionException('You must have Zend Server installed in order to use this handler');
+ }
+ parent::__construct($level, $bubble);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function write(array $record)
+ {
+ $this->writeZendMonitorCustomEvent(
+ $this->levelMap[$record['level']],
+ $record['message'],
+ $record['formatted']
+ );
+ }
+
+ /**
+ * Write a record to Zend Monitor
+ *
+ * @param int $level
+ * @param string $message
+ * @param array $formatted
+ */
+ protected function writeZendMonitorCustomEvent($level, $message, $formatted)
+ {
+ zend_monitor_custom_event($level, $message, $formatted);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDefaultFormatter()
+ {
+ return new NormalizerFormatter();
+ }
+
+ /**
+ * Get the level map
+ *
+ * @return array
+ */
+ public function getLevelMap()
+ {
+ return $this->levelMap;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Logger.php b/vendor/monolog/monolog/src/Monolog/Logger.php
new file mode 100644
index 0000000..49d00af
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Logger.php
@@ -0,0 +1,700 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog;
+
+use Monolog\Handler\HandlerInterface;
+use Monolog\Handler\StreamHandler;
+use Psr\Log\LoggerInterface;
+use Psr\Log\InvalidArgumentException;
+
+/**
+ * Monolog log channel
+ *
+ * It contains a stack of Handlers and a stack of Processors,
+ * and uses them to store records that are added to it.
+ *
+ * @author Jordi Boggiano
+ */
+class Logger implements LoggerInterface
+{
+ /**
+ * Detailed debug information
+ */
+ const DEBUG = 100;
+
+ /**
+ * Interesting events
+ *
+ * Examples: User logs in, SQL logs.
+ */
+ const INFO = 200;
+
+ /**
+ * Uncommon events
+ */
+ const NOTICE = 250;
+
+ /**
+ * Exceptional occurrences that are not errors
+ *
+ * Examples: Use of deprecated APIs, poor use of an API,
+ * undesirable things that are not necessarily wrong.
+ */
+ const WARNING = 300;
+
+ /**
+ * Runtime errors
+ */
+ const ERROR = 400;
+
+ /**
+ * Critical conditions
+ *
+ * Example: Application component unavailable, unexpected exception.
+ */
+ const CRITICAL = 500;
+
+ /**
+ * Action must be taken immediately
+ *
+ * Example: Entire website down, database unavailable, etc.
+ * This should trigger the SMS alerts and wake you up.
+ */
+ const ALERT = 550;
+
+ /**
+ * Urgent alert.
+ */
+ const EMERGENCY = 600;
+
+ /**
+ * Monolog API version
+ *
+ * This is only bumped when API breaks are done and should
+ * follow the major version of the library
+ *
+ * @var int
+ */
+ const API = 1;
+
+ /**
+ * Logging levels from syslog protocol defined in RFC 5424
+ *
+ * @var array $levels Logging levels
+ */
+ protected static $levels = array(
+ self::DEBUG => 'DEBUG',
+ self::INFO => 'INFO',
+ self::NOTICE => 'NOTICE',
+ self::WARNING => 'WARNING',
+ self::ERROR => 'ERROR',
+ self::CRITICAL => 'CRITICAL',
+ self::ALERT => 'ALERT',
+ self::EMERGENCY => 'EMERGENCY',
+ );
+
+ /**
+ * @var \DateTimeZone
+ */
+ protected static $timezone;
+
+ /**
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * The handler stack
+ *
+ * @var HandlerInterface[]
+ */
+ protected $handlers;
+
+ /**
+ * Processors that will process all log records
+ *
+ * To process records of a single handler instead, add the processor on that specific handler
+ *
+ * @var callable[]
+ */
+ protected $processors;
+
+ /**
+ * @var bool
+ */
+ protected $microsecondTimestamps = true;
+
+ /**
+ * @param string $name The logging channel
+ * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc.
+ * @param callable[] $processors Optional array of processors
+ */
+ public function __construct($name, array $handlers = array(), array $processors = array())
+ {
+ $this->name = $name;
+ $this->handlers = $handlers;
+ $this->processors = $processors;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Return a new cloned instance with the name changed
+ *
+ * @return static
+ */
+ public function withName($name)
+ {
+ $new = clone $this;
+ $new->name = $name;
+
+ return $new;
+ }
+
+ /**
+ * Pushes a handler on to the stack.
+ *
+ * @param HandlerInterface $handler
+ * @return $this
+ */
+ public function pushHandler(HandlerInterface $handler)
+ {
+ array_unshift($this->handlers, $handler);
+
+ return $this;
+ }
+
+ /**
+ * Pops a handler from the stack
+ *
+ * @return HandlerInterface
+ */
+ public function popHandler()
+ {
+ if (!$this->handlers) {
+ throw new \LogicException('You tried to pop from an empty handler stack.');
+ }
+
+ return array_shift($this->handlers);
+ }
+
+ /**
+ * Set handlers, replacing all existing ones.
+ *
+ * If a map is passed, keys will be ignored.
+ *
+ * @param HandlerInterface[] $handlers
+ * @return $this
+ */
+ public function setHandlers(array $handlers)
+ {
+ $this->handlers = array();
+ foreach (array_reverse($handlers) as $handler) {
+ $this->pushHandler($handler);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @return HandlerInterface[]
+ */
+ public function getHandlers()
+ {
+ return $this->handlers;
+ }
+
+ /**
+ * Adds a processor on to the stack.
+ *
+ * @param callable $callback
+ * @return $this
+ */
+ public function pushProcessor($callback)
+ {
+ if (!is_callable($callback)) {
+ throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given');
+ }
+ array_unshift($this->processors, $callback);
+
+ return $this;
+ }
+
+ /**
+ * Removes the processor on top of the stack and returns it.
+ *
+ * @return callable
+ */
+ public function popProcessor()
+ {
+ if (!$this->processors) {
+ throw new \LogicException('You tried to pop from an empty processor stack.');
+ }
+
+ return array_shift($this->processors);
+ }
+
+ /**
+ * @return callable[]
+ */
+ public function getProcessors()
+ {
+ return $this->processors;
+ }
+
+ /**
+ * Control the use of microsecond resolution timestamps in the 'datetime'
+ * member of new records.
+ *
+ * Generating microsecond resolution timestamps by calling
+ * microtime(true), formatting the result via sprintf() and then parsing
+ * the resulting string via \DateTime::createFromFormat() can incur
+ * a measurable runtime overhead vs simple usage of DateTime to capture
+ * a second resolution timestamp in systems which generate a large number
+ * of log events.
+ *
+ * @param bool $micro True to use microtime() to create timestamps
+ */
+ public function useMicrosecondTimestamps($micro)
+ {
+ $this->microsecondTimestamps = (bool) $micro;
+ }
+
+ /**
+ * Adds a log record.
+ *
+ * @param int $level The logging level
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function addRecord($level, $message, array $context = array())
+ {
+ if (!$this->handlers) {
+ $this->pushHandler(new StreamHandler('php://stderr', static::DEBUG));
+ }
+
+ $levelName = static::getLevelName($level);
+
+ // check if any handler will handle this message so we can return early and save cycles
+ $handlerKey = null;
+ reset($this->handlers);
+ while ($handler = current($this->handlers)) {
+ if ($handler->isHandling(array('level' => $level))) {
+ $handlerKey = key($this->handlers);
+ break;
+ }
+
+ next($this->handlers);
+ }
+
+ if (null === $handlerKey) {
+ return false;
+ }
+
+ if (!static::$timezone) {
+ static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
+ }
+
+ // php7.1+ always has microseconds enabled, so we do not need this hack
+ if ($this->microsecondTimestamps && PHP_VERSION_ID < 70100) {
+ $ts = \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone);
+ } else {
+ $ts = new \DateTime(null, static::$timezone);
+ }
+ $ts->setTimezone(static::$timezone);
+
+ $record = array(
+ 'message' => (string) $message,
+ 'context' => $context,
+ 'level' => $level,
+ 'level_name' => $levelName,
+ 'channel' => $this->name,
+ 'datetime' => $ts,
+ 'extra' => array(),
+ );
+
+ foreach ($this->processors as $processor) {
+ $record = call_user_func($processor, $record);
+ }
+
+ while ($handler = current($this->handlers)) {
+ if (true === $handler->handle($record)) {
+ break;
+ }
+
+ next($this->handlers);
+ }
+
+ return true;
+ }
+
+ /**
+ * Adds a log record at the DEBUG level.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function addDebug($message, array $context = array())
+ {
+ return $this->addRecord(static::DEBUG, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the INFO level.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function addInfo($message, array $context = array())
+ {
+ return $this->addRecord(static::INFO, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the NOTICE level.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function addNotice($message, array $context = array())
+ {
+ return $this->addRecord(static::NOTICE, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the WARNING level.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function addWarning($message, array $context = array())
+ {
+ return $this->addRecord(static::WARNING, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the ERROR level.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function addError($message, array $context = array())
+ {
+ return $this->addRecord(static::ERROR, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the CRITICAL level.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function addCritical($message, array $context = array())
+ {
+ return $this->addRecord(static::CRITICAL, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the ALERT level.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function addAlert($message, array $context = array())
+ {
+ return $this->addRecord(static::ALERT, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the EMERGENCY level.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function addEmergency($message, array $context = array())
+ {
+ return $this->addRecord(static::EMERGENCY, $message, $context);
+ }
+
+ /**
+ * Gets all supported logging levels.
+ *
+ * @return array Assoc array with human-readable level names => level codes.
+ */
+ public static function getLevels()
+ {
+ return array_flip(static::$levels);
+ }
+
+ /**
+ * Gets the name of the logging level.
+ *
+ * @param int $level
+ * @return string
+ */
+ public static function getLevelName($level)
+ {
+ if (!isset(static::$levels[$level])) {
+ throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels)));
+ }
+
+ return static::$levels[$level];
+ }
+
+ /**
+ * Converts PSR-3 levels to Monolog ones if necessary
+ *
+ * @param string|int Level number (monolog) or name (PSR-3)
+ * @return int
+ */
+ public static function toMonologLevel($level)
+ {
+ if (is_string($level) && defined(__CLASS__.'::'.strtoupper($level))) {
+ return constant(__CLASS__.'::'.strtoupper($level));
+ }
+
+ return $level;
+ }
+
+ /**
+ * Checks whether the Logger has a handler that listens on the given level
+ *
+ * @param int $level
+ * @return Boolean
+ */
+ public function isHandling($level)
+ {
+ $record = array(
+ 'level' => $level,
+ );
+
+ foreach ($this->handlers as $handler) {
+ if ($handler->isHandling($record)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Adds a log record at an arbitrary level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param mixed $level The log level
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function log($level, $message, array $context = array())
+ {
+ $level = static::toMonologLevel($level);
+
+ return $this->addRecord($level, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the DEBUG level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function debug($message, array $context = array())
+ {
+ return $this->addRecord(static::DEBUG, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the INFO level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function info($message, array $context = array())
+ {
+ return $this->addRecord(static::INFO, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the NOTICE level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function notice($message, array $context = array())
+ {
+ return $this->addRecord(static::NOTICE, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the WARNING level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function warn($message, array $context = array())
+ {
+ return $this->addRecord(static::WARNING, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the WARNING level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function warning($message, array $context = array())
+ {
+ return $this->addRecord(static::WARNING, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the ERROR level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function err($message, array $context = array())
+ {
+ return $this->addRecord(static::ERROR, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the ERROR level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function error($message, array $context = array())
+ {
+ return $this->addRecord(static::ERROR, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the CRITICAL level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function crit($message, array $context = array())
+ {
+ return $this->addRecord(static::CRITICAL, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the CRITICAL level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function critical($message, array $context = array())
+ {
+ return $this->addRecord(static::CRITICAL, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the ALERT level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function alert($message, array $context = array())
+ {
+ return $this->addRecord(static::ALERT, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the EMERGENCY level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function emerg($message, array $context = array())
+ {
+ return $this->addRecord(static::EMERGENCY, $message, $context);
+ }
+
+ /**
+ * Adds a log record at the EMERGENCY level.
+ *
+ * This method allows for compatibility with common interfaces.
+ *
+ * @param string $message The log message
+ * @param array $context The log context
+ * @return Boolean Whether the record has been processed
+ */
+ public function emergency($message, array $context = array())
+ {
+ return $this->addRecord(static::EMERGENCY, $message, $context);
+ }
+
+ /**
+ * Set the timezone to be used for the timestamp of log records.
+ *
+ * This is stored globally for all Logger instances
+ *
+ * @param \DateTimeZone $tz Timezone object
+ */
+ public static function setTimezone(\DateTimeZone $tz)
+ {
+ self::$timezone = $tz;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php
new file mode 100644
index 0000000..1899400
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php
@@ -0,0 +1,64 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+use Monolog\Logger;
+
+/**
+ * Injects Git branch and Git commit SHA in all records
+ *
+ * @author Nick Otter
+ * @author Jordi Boggiano
+ */
+class GitProcessor
+{
+ private $level;
+ private static $cache;
+
+ public function __construct($level = Logger::DEBUG)
+ {
+ $this->level = Logger::toMonologLevel($level);
+ }
+
+ /**
+ * @param array $record
+ * @return array
+ */
+ public function __invoke(array $record)
+ {
+ // return if the level is not high enough
+ if ($record['level'] < $this->level) {
+ return $record;
+ }
+
+ $record['extra']['git'] = self::getGitInfo();
+
+ return $record;
+ }
+
+ private static function getGitInfo()
+ {
+ if (self::$cache) {
+ return self::$cache;
+ }
+
+ $branches = `git branch -v --no-abbrev`;
+ if (preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) {
+ return self::$cache = array(
+ 'branch' => $matches[1],
+ 'commit' => $matches[2],
+ );
+ }
+
+ return self::$cache = array();
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php
new file mode 100644
index 0000000..2c07cae
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php
@@ -0,0 +1,112 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+use Monolog\Logger;
+
+/**
+ * Injects line/file:class/function where the log message came from
+ *
+ * Warning: This only works if the handler processes the logs directly.
+ * If you put the processor on a handler that is behind a FingersCrossedHandler
+ * for example, the processor will only be called once the trigger level is reached,
+ * and all the log records will have the same file/line/.. data from the call that
+ * triggered the FingersCrossedHandler.
+ *
+ * @author Jordi Boggiano
+ */
+class IntrospectionProcessor
+{
+ private $level;
+
+ private $skipClassesPartials;
+
+ private $skipStackFramesCount;
+
+ private $skipFunctions = array(
+ 'call_user_func',
+ 'call_user_func_array',
+ );
+
+ public function __construct($level = Logger::DEBUG, array $skipClassesPartials = array(), $skipStackFramesCount = 0)
+ {
+ $this->level = Logger::toMonologLevel($level);
+ $this->skipClassesPartials = array_merge(array('Monolog\\'), $skipClassesPartials);
+ $this->skipStackFramesCount = $skipStackFramesCount;
+ }
+
+ /**
+ * @param array $record
+ * @return array
+ */
+ public function __invoke(array $record)
+ {
+ // return if the level is not high enough
+ if ($record['level'] < $this->level) {
+ return $record;
+ }
+
+ /*
+ * http://php.net/manual/en/function.debug-backtrace.php
+ * As of 5.3.6, DEBUG_BACKTRACE_IGNORE_ARGS option was added.
+ * Any version less than 5.3.6 must use the DEBUG_BACKTRACE_IGNORE_ARGS constant value '2'.
+ */
+ $trace = debug_backtrace((PHP_VERSION_ID < 50306) ? 2 : DEBUG_BACKTRACE_IGNORE_ARGS);
+
+ // skip first since it's always the current method
+ array_shift($trace);
+ // the call_user_func call is also skipped
+ array_shift($trace);
+
+ $i = 0;
+
+ while ($this->isTraceClassOrSkippedFunction($trace, $i)) {
+ if (isset($trace[$i]['class'])) {
+ foreach ($this->skipClassesPartials as $part) {
+ if (strpos($trace[$i]['class'], $part) !== false) {
+ $i++;
+ continue 2;
+ }
+ }
+ } elseif (in_array($trace[$i]['function'], $this->skipFunctions)) {
+ $i++;
+ continue;
+ }
+
+ break;
+ }
+
+ $i += $this->skipStackFramesCount;
+
+ // we should have the call source now
+ $record['extra'] = array_merge(
+ $record['extra'],
+ array(
+ 'file' => isset($trace[$i - 1]['file']) ? $trace[$i - 1]['file'] : null,
+ 'line' => isset($trace[$i - 1]['line']) ? $trace[$i - 1]['line'] : null,
+ 'class' => isset($trace[$i]['class']) ? $trace[$i]['class'] : null,
+ 'function' => isset($trace[$i]['function']) ? $trace[$i]['function'] : null,
+ )
+ );
+
+ return $record;
+ }
+
+ private function isTraceClassOrSkippedFunction(array $trace, $index)
+ {
+ if (!isset($trace[$index])) {
+ return false;
+ }
+
+ return isset($trace[$index]['class']) || in_array($trace[$index]['function'], $this->skipFunctions);
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php
new file mode 100644
index 0000000..0543e92
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php
@@ -0,0 +1,35 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+/**
+ * Injects memory_get_peak_usage in all records
+ *
+ * @see Monolog\Processor\MemoryProcessor::__construct() for options
+ * @author Rob Jensen
+ */
+class MemoryPeakUsageProcessor extends MemoryProcessor
+{
+ /**
+ * @param array $record
+ * @return array
+ */
+ public function __invoke(array $record)
+ {
+ $bytes = memory_get_peak_usage($this->realUsage);
+ $formatted = $this->formatBytes($bytes);
+
+ $record['extra']['memory_peak_usage'] = $formatted;
+
+ return $record;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php
new file mode 100644
index 0000000..85f9dc5
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php
@@ -0,0 +1,63 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+/**
+ * Some methods that are common for all memory processors
+ *
+ * @author Rob Jensen
+ */
+abstract class MemoryProcessor
+{
+ /**
+ * @var bool If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported.
+ */
+ protected $realUsage;
+
+ /**
+ * @var bool If true, then format memory size to human readable string (MB, KB, B depending on size)
+ */
+ protected $useFormatting;
+
+ /**
+ * @param bool $realUsage Set this to true to get the real size of memory allocated from system.
+ * @param bool $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size)
+ */
+ public function __construct($realUsage = true, $useFormatting = true)
+ {
+ $this->realUsage = (boolean) $realUsage;
+ $this->useFormatting = (boolean) $useFormatting;
+ }
+
+ /**
+ * Formats bytes into a human readable string if $this->useFormatting is true, otherwise return $bytes as is
+ *
+ * @param int $bytes
+ * @return string|int Formatted string if $this->useFormatting is true, otherwise return $bytes as is
+ */
+ protected function formatBytes($bytes)
+ {
+ $bytes = (int) $bytes;
+
+ if (!$this->useFormatting) {
+ return $bytes;
+ }
+
+ if ($bytes > 1024 * 1024) {
+ return round($bytes / 1024 / 1024, 2).' MB';
+ } elseif ($bytes > 1024) {
+ return round($bytes / 1024, 2).' KB';
+ }
+
+ return $bytes . ' B';
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php
new file mode 100644
index 0000000..2783d65
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php
@@ -0,0 +1,35 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+/**
+ * Injects memory_get_usage in all records
+ *
+ * @see Monolog\Processor\MemoryProcessor::__construct() for options
+ * @author Rob Jensen
+ */
+class MemoryUsageProcessor extends MemoryProcessor
+{
+ /**
+ * @param array $record
+ * @return array
+ */
+ public function __invoke(array $record)
+ {
+ $bytes = memory_get_usage($this->realUsage);
+ $formatted = $this->formatBytes($bytes);
+
+ $record['extra']['memory_usage'] = $formatted;
+
+ return $record;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php
new file mode 100644
index 0000000..7c07a7e
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php
@@ -0,0 +1,63 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+use Monolog\Logger;
+
+/**
+ * Injects Hg branch and Hg revision number in all records
+ *
+ * @author Jonathan A. Schweder
+ */
+class MercurialProcessor
+{
+ private $level;
+ private static $cache;
+
+ public function __construct($level = Logger::DEBUG)
+ {
+ $this->level = Logger::toMonologLevel($level);
+ }
+
+ /**
+ * @param array $record
+ * @return array
+ */
+ public function __invoke(array $record)
+ {
+ // return if the level is not high enough
+ if ($record['level'] < $this->level) {
+ return $record;
+ }
+
+ $record['extra']['hg'] = self::getMercurialInfo();
+
+ return $record;
+ }
+
+ private static function getMercurialInfo()
+ {
+ if (self::$cache) {
+ return self::$cache;
+ }
+
+ $result = explode(' ', trim(`hg id -nb`));
+ if (count($result) >= 3) {
+ return self::$cache = array(
+ 'branch' => $result[1],
+ 'revision' => $result[2],
+ );
+ }
+
+ return self::$cache = array();
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php
new file mode 100644
index 0000000..9d3f559
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+/**
+ * Adds value of getmypid into records
+ *
+ * @author Andreas Hörnicke
+ */
+class ProcessIdProcessor
+{
+ /**
+ * @param array $record
+ * @return array
+ */
+ public function __invoke(array $record)
+ {
+ $record['extra']['process_id'] = getmypid();
+
+ return $record;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php
new file mode 100644
index 0000000..c2686ce
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php
@@ -0,0 +1,48 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+/**
+ * Processes a record's message according to PSR-3 rules
+ *
+ * It replaces {foo} with the value from $context['foo']
+ *
+ * @author Jordi Boggiano
+ */
+class PsrLogMessageProcessor
+{
+ /**
+ * @param array $record
+ * @return array
+ */
+ public function __invoke(array $record)
+ {
+ if (false === strpos($record['message'], '{')) {
+ return $record;
+ }
+
+ $replacements = array();
+ foreach ($record['context'] as $key => $val) {
+ if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) {
+ $replacements['{'.$key.'}'] = $val;
+ } elseif (is_object($val)) {
+ $replacements['{'.$key.'}'] = '[object '.get_class($val).']';
+ } else {
+ $replacements['{'.$key.'}'] = '['.gettype($val).']';
+ }
+ }
+
+ $record['message'] = strtr($record['message'], $replacements);
+
+ return $record;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php
new file mode 100644
index 0000000..7e2df2a
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php
@@ -0,0 +1,44 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+/**
+ * Adds a tags array into record
+ *
+ * @author Martijn Riemers
+ */
+class TagProcessor
+{
+ private $tags;
+
+ public function __construct(array $tags = array())
+ {
+ $this->setTags($tags);
+ }
+
+ public function addTags(array $tags = array())
+ {
+ $this->tags = array_merge($this->tags, $tags);
+ }
+
+ public function setTags(array $tags = array())
+ {
+ $this->tags = $tags;
+ }
+
+ public function __invoke(array $record)
+ {
+ $record['extra']['tags'] = $this->tags;
+
+ return $record;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php
new file mode 100644
index 0000000..812707c
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php
@@ -0,0 +1,46 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+/**
+ * Adds a unique identifier into records
+ *
+ * @author Simon Mönch
+ */
+class UidProcessor
+{
+ private $uid;
+
+ public function __construct($length = 7)
+ {
+ if (!is_int($length) || $length > 32 || $length < 1) {
+ throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32');
+ }
+
+ $this->uid = substr(hash('md5', uniqid('', true)), 0, $length);
+ }
+
+ public function __invoke(array $record)
+ {
+ $record['extra']['uid'] = $this->uid;
+
+ return $record;
+ }
+
+ /**
+ * @return string
+ */
+ public function getUid()
+ {
+ return $this->uid;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php
new file mode 100644
index 0000000..ea1d897
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php
@@ -0,0 +1,113 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+/**
+ * Injects url/method and remote IP of the current web request in all records
+ *
+ * @author Jordi Boggiano
+ */
+class WebProcessor
+{
+ /**
+ * @var array|\ArrayAccess
+ */
+ protected $serverData;
+
+ /**
+ * Default fields
+ *
+ * Array is structured as [key in record.extra => key in $serverData]
+ *
+ * @var array
+ */
+ protected $extraFields = array(
+ 'url' => 'REQUEST_URI',
+ 'ip' => 'REMOTE_ADDR',
+ 'http_method' => 'REQUEST_METHOD',
+ 'server' => 'SERVER_NAME',
+ 'referrer' => 'HTTP_REFERER',
+ );
+
+ /**
+ * @param array|\ArrayAccess $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data
+ * @param array|null $extraFields Field names and the related key inside $serverData to be added. If not provided it defaults to: url, ip, http_method, server, referrer
+ */
+ public function __construct($serverData = null, array $extraFields = null)
+ {
+ if (null === $serverData) {
+ $this->serverData = &$_SERVER;
+ } elseif (is_array($serverData) || $serverData instanceof \ArrayAccess) {
+ $this->serverData = $serverData;
+ } else {
+ throw new \UnexpectedValueException('$serverData must be an array or object implementing ArrayAccess.');
+ }
+
+ if (null !== $extraFields) {
+ if (isset($extraFields[0])) {
+ foreach (array_keys($this->extraFields) as $fieldName) {
+ if (!in_array($fieldName, $extraFields)) {
+ unset($this->extraFields[$fieldName]);
+ }
+ }
+ } else {
+ $this->extraFields = $extraFields;
+ }
+ }
+ }
+
+ /**
+ * @param array $record
+ * @return array
+ */
+ public function __invoke(array $record)
+ {
+ // skip processing if for some reason request data
+ // is not present (CLI or wonky SAPIs)
+ if (!isset($this->serverData['REQUEST_URI'])) {
+ return $record;
+ }
+
+ $record['extra'] = $this->appendExtraFields($record['extra']);
+
+ return $record;
+ }
+
+ /**
+ * @param string $extraName
+ * @param string $serverName
+ * @return $this
+ */
+ public function addExtraField($extraName, $serverName)
+ {
+ $this->extraFields[$extraName] = $serverName;
+
+ return $this;
+ }
+
+ /**
+ * @param array $extra
+ * @return array
+ */
+ private function appendExtraFields(array $extra)
+ {
+ foreach ($this->extraFields as $extraName => $serverName) {
+ $extra[$extraName] = isset($this->serverData[$serverName]) ? $this->serverData[$serverName] : null;
+ }
+
+ if (isset($this->serverData['UNIQUE_ID'])) {
+ $extra['unique_id'] = $this->serverData['UNIQUE_ID'];
+ }
+
+ return $extra;
+ }
+}
diff --git a/vendor/monolog/monolog/src/Monolog/Registry.php b/vendor/monolog/monolog/src/Monolog/Registry.php
new file mode 100644
index 0000000..159b751
--- /dev/null
+++ b/vendor/monolog/monolog/src/Monolog/Registry.php
@@ -0,0 +1,134 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog;
+
+use InvalidArgumentException;
+
+/**
+ * Monolog log registry
+ *
+ * Allows to get `Logger` instances in the global scope
+ * via static method calls on this class.
+ *
+ *
+ * $application = new Monolog\Logger('application');
+ * $api = new Monolog\Logger('api');
+ *
+ * Monolog\Registry::addLogger($application);
+ * Monolog\Registry::addLogger($api);
+ *
+ * function testLogger()
+ * {
+ * Monolog\Registry::api()->addError('Sent to $api Logger instance');
+ * Monolog\Registry::application()->addError('Sent to $application Logger instance');
+ * }
+ *
+ *
+ * @author Tomas Tatarko
+ */
+class Registry
+{
+ /**
+ * List of all loggers in the registry (by named indexes)
+ *
+ * @var Logger[]
+ */
+ private static $loggers = array();
+
+ /**
+ * Adds new logging channel to the registry
+ *
+ * @param Logger $logger Instance of the logging channel
+ * @param string|null $name Name of the logging channel ($logger->getName() by default)
+ * @param bool $overwrite Overwrite instance in the registry if the given name already exists?
+ * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists
+ */
+ public static function addLogger(Logger $logger, $name = null, $overwrite = false)
+ {
+ $name = $name ?: $logger->getName();
+
+ if (isset(self::$loggers[$name]) && !$overwrite) {
+ throw new InvalidArgumentException('Logger with the given name already exists');
+ }
+
+ self::$loggers[$name] = $logger;
+ }
+
+ /**
+ * Checks if such logging channel exists by name or instance
+ *
+ * @param string|Logger $logger Name or logger instance
+ */
+ public static function hasLogger($logger)
+ {
+ if ($logger instanceof Logger) {
+ $index = array_search($logger, self::$loggers, true);
+
+ return false !== $index;
+ } else {
+ return isset(self::$loggers[$logger]);
+ }
+ }
+
+ /**
+ * Removes instance from registry by name or instance
+ *
+ * @param string|Logger $logger Name or logger instance
+ */
+ public static function removeLogger($logger)
+ {
+ if ($logger instanceof Logger) {
+ if (false !== ($idx = array_search($logger, self::$loggers, true))) {
+ unset(self::$loggers[$idx]);
+ }
+ } else {
+ unset(self::$loggers[$logger]);
+ }
+ }
+
+ /**
+ * Clears the registry
+ */
+ public static function clear()
+ {
+ self::$loggers = array();
+ }
+
+ /**
+ * Gets Logger instance from the registry
+ *
+ * @param string $name Name of the requested Logger instance
+ * @throws \InvalidArgumentException If named Logger instance is not in the registry
+ * @return Logger Requested instance of Logger
+ */
+ public static function getInstance($name)
+ {
+ if (!isset(self::$loggers[$name])) {
+ throw new InvalidArgumentException(sprintf('Requested "%s" logger instance is not in the registry', $name));
+ }
+
+ return self::$loggers[$name];
+ }
+
+ /**
+ * Gets Logger instance from the registry via static method call
+ *
+ * @param string $name Name of the requested Logger instance
+ * @param array $arguments Arguments passed to static method call
+ * @throws \InvalidArgumentException If named Logger instance is not in the registry
+ * @return Logger Requested instance of Logger
+ */
+ public static function __callStatic($name, $arguments)
+ {
+ return self::getInstance($name);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php
new file mode 100644
index 0000000..a9a3f30
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/ErrorHandlerTest.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog;
+
+use Monolog\Handler\TestHandler;
+
+class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
+{
+ public function testHandleError()
+ {
+ $logger = new Logger('test', array($handler = new TestHandler));
+ $errHandler = new ErrorHandler($logger);
+
+ $errHandler->registerErrorHandler(array(E_USER_NOTICE => Logger::EMERGENCY), false);
+ trigger_error('Foo', E_USER_ERROR);
+ $this->assertCount(1, $handler->getRecords());
+ $this->assertTrue($handler->hasErrorRecords());
+ trigger_error('Foo', E_USER_NOTICE);
+ $this->assertCount(2, $handler->getRecords());
+ $this->assertTrue($handler->hasEmergencyRecords());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php
new file mode 100644
index 0000000..71c4204
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php
@@ -0,0 +1,158 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+
+class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @covers Monolog\Formatter\ChromePHPFormatter::format
+ */
+ public function testDefaultFormat()
+ {
+ $formatter = new ChromePHPFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('ip' => '127.0.0.1'),
+ 'message' => 'log',
+ );
+
+ $message = $formatter->format($record);
+
+ $this->assertEquals(
+ array(
+ 'meh',
+ array(
+ 'message' => 'log',
+ 'context' => array('from' => 'logger'),
+ 'extra' => array('ip' => '127.0.0.1'),
+ ),
+ 'unknown',
+ 'error',
+ ),
+ $message
+ );
+ }
+
+ /**
+ * @covers Monolog\Formatter\ChromePHPFormatter::format
+ */
+ public function testFormatWithFileAndLine()
+ {
+ $formatter = new ChromePHPFormatter();
+ $record = array(
+ 'level' => Logger::CRITICAL,
+ 'level_name' => 'CRITICAL',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('ip' => '127.0.0.1', 'file' => 'test', 'line' => 14),
+ 'message' => 'log',
+ );
+
+ $message = $formatter->format($record);
+
+ $this->assertEquals(
+ array(
+ 'meh',
+ array(
+ 'message' => 'log',
+ 'context' => array('from' => 'logger'),
+ 'extra' => array('ip' => '127.0.0.1'),
+ ),
+ 'test : 14',
+ 'error',
+ ),
+ $message
+ );
+ }
+
+ /**
+ * @covers Monolog\Formatter\ChromePHPFormatter::format
+ */
+ public function testFormatWithoutContext()
+ {
+ $formatter = new ChromePHPFormatter();
+ $record = array(
+ 'level' => Logger::DEBUG,
+ 'level_name' => 'DEBUG',
+ 'channel' => 'meh',
+ 'context' => array(),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'log',
+ );
+
+ $message = $formatter->format($record);
+
+ $this->assertEquals(
+ array(
+ 'meh',
+ 'log',
+ 'unknown',
+ 'log',
+ ),
+ $message
+ );
+ }
+
+ /**
+ * @covers Monolog\Formatter\ChromePHPFormatter::formatBatch
+ */
+ public function testBatchFormatThrowException()
+ {
+ $formatter = new ChromePHPFormatter();
+ $records = array(
+ array(
+ 'level' => Logger::INFO,
+ 'level_name' => 'INFO',
+ 'channel' => 'meh',
+ 'context' => array(),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'log',
+ ),
+ array(
+ 'level' => Logger::WARNING,
+ 'level_name' => 'WARNING',
+ 'channel' => 'foo',
+ 'context' => array(),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'log2',
+ ),
+ );
+
+ $this->assertEquals(
+ array(
+ array(
+ 'meh',
+ 'log',
+ 'unknown',
+ 'info',
+ ),
+ array(
+ 'foo',
+ 'log2',
+ 'unknown',
+ 'warn',
+ ),
+ ),
+ $formatter->formatBatch($records)
+ );
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php
new file mode 100644
index 0000000..90cc48d
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php
@@ -0,0 +1,79 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+
+class ElasticaFormatterTest extends \PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ if (!class_exists("Elastica\Document")) {
+ $this->markTestSkipped("ruflin/elastica not installed");
+ }
+ }
+
+ /**
+ * @covers Monolog\Formatter\ElasticaFormatter::__construct
+ * @covers Monolog\Formatter\ElasticaFormatter::format
+ * @covers Monolog\Formatter\ElasticaFormatter::getDocument
+ */
+ public function testFormat()
+ {
+ // test log message
+ $msg = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'log',
+ );
+
+ // expected values
+ $expected = $msg;
+ $expected['datetime'] = '1970-01-01T00:00:00.000000+00:00';
+ $expected['context'] = array(
+ 'class' => '[object] (stdClass: {})',
+ 'foo' => 7,
+ 0 => 'bar',
+ );
+
+ // format log message
+ $formatter = new ElasticaFormatter('my_index', 'doc_type');
+ $doc = $formatter->format($msg);
+ $this->assertInstanceOf('Elastica\Document', $doc);
+
+ // Document parameters
+ $params = $doc->getParams();
+ $this->assertEquals('my_index', $params['_index']);
+ $this->assertEquals('doc_type', $params['_type']);
+
+ // Document data values
+ $data = $doc->getData();
+ foreach (array_keys($expected) as $key) {
+ $this->assertEquals($expected[$key], $data[$key]);
+ }
+ }
+
+ /**
+ * @covers Monolog\Formatter\ElasticaFormatter::getIndex
+ * @covers Monolog\Formatter\ElasticaFormatter::getType
+ */
+ public function testGetters()
+ {
+ $formatter = new ElasticaFormatter('my_index', 'doc_type');
+ $this->assertEquals('my_index', $formatter->getIndex());
+ $this->assertEquals('doc_type', $formatter->getType());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php
new file mode 100644
index 0000000..1b2fd97
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php
@@ -0,0 +1,55 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+use Monolog\TestCase;
+
+class FlowdockFormatterTest extends TestCase
+{
+ /**
+ * @covers Monolog\Formatter\FlowdockFormatter::format
+ */
+ public function testFormat()
+ {
+ $formatter = new FlowdockFormatter('test_source', 'source@test.com');
+ $record = $this->getRecord();
+
+ $expected = array(
+ 'source' => 'test_source',
+ 'from_address' => 'source@test.com',
+ 'subject' => 'in test_source: WARNING - test',
+ 'content' => 'test',
+ 'tags' => array('#logs', '#warning', '#test'),
+ 'project' => 'test_source',
+ );
+ $formatted = $formatter->format($record);
+
+ $this->assertEquals($expected, $formatted['flowdock']);
+ }
+
+ /**
+ * @ covers Monolog\Formatter\FlowdockFormatter::formatBatch
+ */
+ public function testFormatBatch()
+ {
+ $formatter = new FlowdockFormatter('test_source', 'source@test.com');
+ $records = array(
+ $this->getRecord(Logger::WARNING),
+ $this->getRecord(Logger::DEBUG),
+ );
+ $formatted = $formatter->formatBatch($records);
+
+ $this->assertArrayHasKey('flowdock', $formatted[0]);
+ $this->assertArrayHasKey('flowdock', $formatted[1]);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php
new file mode 100644
index 0000000..622b2ba
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php
@@ -0,0 +1,62 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+use Monolog\TestCase;
+
+class FluentdFormatterTest extends TestCase
+{
+ /**
+ * @covers Monolog\Formatter\FluentdFormatter::__construct
+ * @covers Monolog\Formatter\FluentdFormatter::isUsingLevelsInTag
+ */
+ public function testConstruct()
+ {
+ $formatter = new FluentdFormatter();
+ $this->assertEquals(false, $formatter->isUsingLevelsInTag());
+ $formatter = new FluentdFormatter(false);
+ $this->assertEquals(false, $formatter->isUsingLevelsInTag());
+ $formatter = new FluentdFormatter(true);
+ $this->assertEquals(true, $formatter->isUsingLevelsInTag());
+ }
+
+ /**
+ * @covers Monolog\Formatter\FluentdFormatter::format
+ */
+ public function testFormat()
+ {
+ $record = $this->getRecord(Logger::WARNING);
+ $record['datetime'] = new \DateTime("@0");
+
+ $formatter = new FluentdFormatter();
+ $this->assertEquals(
+ '["test",0,{"message":"test","extra":[],"level":300,"level_name":"WARNING"}]',
+ $formatter->format($record)
+ );
+ }
+
+ /**
+ * @covers Monolog\Formatter\FluentdFormatter::format
+ */
+ public function testFormatWithTag()
+ {
+ $record = $this->getRecord(Logger::ERROR);
+ $record['datetime'] = new \DateTime("@0");
+
+ $formatter = new FluentdFormatter(true);
+ $this->assertEquals(
+ '["test.error",0,{"message":"test","extra":[]}]',
+ $formatter->format($record)
+ );
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php
new file mode 100644
index 0000000..4a24761
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php
@@ -0,0 +1,258 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+
+class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ if (!class_exists('\Gelf\Message')) {
+ $this->markTestSkipped("graylog2/gelf-php or mlehner/gelf-php is not installed");
+ }
+ }
+
+ /**
+ * @covers Monolog\Formatter\GelfMessageFormatter::format
+ */
+ public function testDefaultFormatter()
+ {
+ $formatter = new GelfMessageFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array(),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'log',
+ );
+
+ $message = $formatter->format($record);
+
+ $this->assertInstanceOf('Gelf\Message', $message);
+ $this->assertEquals(0, $message->getTimestamp());
+ $this->assertEquals('log', $message->getShortMessage());
+ $this->assertEquals('meh', $message->getFacility());
+ $this->assertEquals(null, $message->getLine());
+ $this->assertEquals(null, $message->getFile());
+ $this->assertEquals($this->isLegacy() ? 3 : 'error', $message->getLevel());
+ $this->assertNotEmpty($message->getHost());
+
+ $formatter = new GelfMessageFormatter('mysystem');
+
+ $message = $formatter->format($record);
+
+ $this->assertInstanceOf('Gelf\Message', $message);
+ $this->assertEquals('mysystem', $message->getHost());
+ }
+
+ /**
+ * @covers Monolog\Formatter\GelfMessageFormatter::format
+ */
+ public function testFormatWithFileAndLine()
+ {
+ $formatter = new GelfMessageFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('file' => 'test', 'line' => 14),
+ 'message' => 'log',
+ );
+
+ $message = $formatter->format($record);
+
+ $this->assertInstanceOf('Gelf\Message', $message);
+ $this->assertEquals('test', $message->getFile());
+ $this->assertEquals(14, $message->getLine());
+ }
+
+ /**
+ * @covers Monolog\Formatter\GelfMessageFormatter::format
+ * @expectedException InvalidArgumentException
+ */
+ public function testFormatInvalidFails()
+ {
+ $formatter = new GelfMessageFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ );
+
+ $formatter->format($record);
+ }
+
+ /**
+ * @covers Monolog\Formatter\GelfMessageFormatter::format
+ */
+ public function testFormatWithContext()
+ {
+ $formatter = new GelfMessageFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('key' => 'pair'),
+ 'message' => 'log',
+ );
+
+ $message = $formatter->format($record);
+
+ $this->assertInstanceOf('Gelf\Message', $message);
+
+ $message_array = $message->toArray();
+
+ $this->assertArrayHasKey('_ctxt_from', $message_array);
+ $this->assertEquals('logger', $message_array['_ctxt_from']);
+
+ // Test with extraPrefix
+ $formatter = new GelfMessageFormatter(null, null, 'CTX');
+ $message = $formatter->format($record);
+
+ $this->assertInstanceOf('Gelf\Message', $message);
+
+ $message_array = $message->toArray();
+
+ $this->assertArrayHasKey('_CTXfrom', $message_array);
+ $this->assertEquals('logger', $message_array['_CTXfrom']);
+ }
+
+ /**
+ * @covers Monolog\Formatter\GelfMessageFormatter::format
+ */
+ public function testFormatWithContextContainingException()
+ {
+ $formatter = new GelfMessageFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger', 'exception' => array(
+ 'class' => '\Exception',
+ 'file' => '/some/file/in/dir.php:56',
+ 'trace' => array('/some/file/1.php:23', '/some/file/2.php:3'),
+ )),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'log',
+ );
+
+ $message = $formatter->format($record);
+
+ $this->assertInstanceOf('Gelf\Message', $message);
+
+ $this->assertEquals("/some/file/in/dir.php", $message->getFile());
+ $this->assertEquals("56", $message->getLine());
+ }
+
+ /**
+ * @covers Monolog\Formatter\GelfMessageFormatter::format
+ */
+ public function testFormatWithExtra()
+ {
+ $formatter = new GelfMessageFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('key' => 'pair'),
+ 'message' => 'log',
+ );
+
+ $message = $formatter->format($record);
+
+ $this->assertInstanceOf('Gelf\Message', $message);
+
+ $message_array = $message->toArray();
+
+ $this->assertArrayHasKey('_key', $message_array);
+ $this->assertEquals('pair', $message_array['_key']);
+
+ // Test with extraPrefix
+ $formatter = new GelfMessageFormatter(null, 'EXT');
+ $message = $formatter->format($record);
+
+ $this->assertInstanceOf('Gelf\Message', $message);
+
+ $message_array = $message->toArray();
+
+ $this->assertArrayHasKey('_EXTkey', $message_array);
+ $this->assertEquals('pair', $message_array['_EXTkey']);
+ }
+
+ public function testFormatWithLargeData()
+ {
+ $formatter = new GelfMessageFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('exception' => str_repeat(' ', 32767)),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('key' => str_repeat(' ', 32767)),
+ 'message' => 'log'
+ );
+ $message = $formatter->format($record);
+ $messageArray = $message->toArray();
+
+ // 200 for padding + metadata
+ $length = 200;
+
+ foreach ($messageArray as $key => $value) {
+ if (!in_array($key, array('level', 'timestamp'))) {
+ $length += strlen($value);
+ }
+ }
+
+ $this->assertLessThanOrEqual(65792, $length, 'The message length is no longer than the maximum allowed length');
+ }
+
+ public function testFormatWithUnlimitedLength()
+ {
+ $formatter = new GelfMessageFormatter('LONG_SYSTEM_NAME', null, 'ctxt_', PHP_INT_MAX);
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('exception' => str_repeat(' ', 32767 * 2)),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('key' => str_repeat(' ', 32767 * 2)),
+ 'message' => 'log'
+ );
+ $message = $formatter->format($record);
+ $messageArray = $message->toArray();
+
+ // 200 for padding + metadata
+ $length = 200;
+
+ foreach ($messageArray as $key => $value) {
+ if (!in_array($key, array('level', 'timestamp'))) {
+ $length += strlen($value);
+ }
+ }
+
+ $this->assertGreaterThanOrEqual(131289, $length, 'The message should not be truncated');
+ }
+
+ private function isLegacy()
+ {
+ return interface_exists('\Gelf\IMessagePublisher');
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php
new file mode 100644
index 0000000..c9445f3
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php
@@ -0,0 +1,183 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+use Monolog\TestCase;
+
+class JsonFormatterTest extends TestCase
+{
+ /**
+ * @covers Monolog\Formatter\JsonFormatter::__construct
+ * @covers Monolog\Formatter\JsonFormatter::getBatchMode
+ * @covers Monolog\Formatter\JsonFormatter::isAppendingNewlines
+ */
+ public function testConstruct()
+ {
+ $formatter = new JsonFormatter();
+ $this->assertEquals(JsonFormatter::BATCH_MODE_JSON, $formatter->getBatchMode());
+ $this->assertEquals(true, $formatter->isAppendingNewlines());
+ $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_NEWLINES, false);
+ $this->assertEquals(JsonFormatter::BATCH_MODE_NEWLINES, $formatter->getBatchMode());
+ $this->assertEquals(false, $formatter->isAppendingNewlines());
+ }
+
+ /**
+ * @covers Monolog\Formatter\JsonFormatter::format
+ */
+ public function testFormat()
+ {
+ $formatter = new JsonFormatter();
+ $record = $this->getRecord();
+ $this->assertEquals(json_encode($record)."\n", $formatter->format($record));
+
+ $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_JSON, false);
+ $record = $this->getRecord();
+ $this->assertEquals(json_encode($record), $formatter->format($record));
+ }
+
+ /**
+ * @covers Monolog\Formatter\JsonFormatter::formatBatch
+ * @covers Monolog\Formatter\JsonFormatter::formatBatchJson
+ */
+ public function testFormatBatch()
+ {
+ $formatter = new JsonFormatter();
+ $records = array(
+ $this->getRecord(Logger::WARNING),
+ $this->getRecord(Logger::DEBUG),
+ );
+ $this->assertEquals(json_encode($records), $formatter->formatBatch($records));
+ }
+
+ /**
+ * @covers Monolog\Formatter\JsonFormatter::formatBatch
+ * @covers Monolog\Formatter\JsonFormatter::formatBatchNewlines
+ */
+ public function testFormatBatchNewlines()
+ {
+ $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_NEWLINES);
+ $records = $expected = array(
+ $this->getRecord(Logger::WARNING),
+ $this->getRecord(Logger::DEBUG),
+ );
+ array_walk($expected, function (&$value, $key) {
+ $value = json_encode($value);
+ });
+ $this->assertEquals(implode("\n", $expected), $formatter->formatBatch($records));
+ }
+
+ public function testDefFormatWithException()
+ {
+ $formatter = new JsonFormatter();
+ $exception = new \RuntimeException('Foo');
+ $formattedException = $this->formatException($exception);
+
+ $message = $this->formatRecordWithExceptionInContext($formatter, $exception);
+
+ $this->assertContextContainsFormattedException($formattedException, $message);
+ }
+
+ public function testDefFormatWithPreviousException()
+ {
+ $formatter = new JsonFormatter();
+ $exception = new \RuntimeException('Foo', 0, new \LogicException('Wut?'));
+ $formattedPrevException = $this->formatException($exception->getPrevious());
+ $formattedException = $this->formatException($exception, $formattedPrevException);
+
+ $message = $this->formatRecordWithExceptionInContext($formatter, $exception);
+
+ $this->assertContextContainsFormattedException($formattedException, $message);
+ }
+
+ public function testDefFormatWithThrowable()
+ {
+ if (!class_exists('Error') || !is_subclass_of('Error', 'Throwable')) {
+ $this->markTestSkipped('Requires PHP >=7');
+ }
+
+ $formatter = new JsonFormatter();
+ $throwable = new \Error('Foo');
+ $formattedThrowable = $this->formatException($throwable);
+
+ $message = $this->formatRecordWithExceptionInContext($formatter, $throwable);
+
+ $this->assertContextContainsFormattedException($formattedThrowable, $message);
+ }
+
+ /**
+ * @param string $expected
+ * @param string $actual
+ *
+ * @internal param string $exception
+ */
+ private function assertContextContainsFormattedException($expected, $actual)
+ {
+ $this->assertEquals(
+ '{"level_name":"CRITICAL","channel":"core","context":{"exception":'.$expected.'},"datetime":null,"extra":[],"message":"foobar"}'."\n",
+ $actual
+ );
+ }
+
+ /**
+ * @param JsonFormatter $formatter
+ * @param \Exception|\Throwable $exception
+ *
+ * @return string
+ */
+ private function formatRecordWithExceptionInContext(JsonFormatter $formatter, $exception)
+ {
+ $message = $formatter->format(array(
+ 'level_name' => 'CRITICAL',
+ 'channel' => 'core',
+ 'context' => array('exception' => $exception),
+ 'datetime' => null,
+ 'extra' => array(),
+ 'message' => 'foobar',
+ ));
+ return $message;
+ }
+
+ /**
+ * @param \Exception|\Throwable $exception
+ *
+ * @return string
+ */
+ private function formatExceptionFilePathWithLine($exception)
+ {
+ $options = 0;
+ if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
+ $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
+ }
+ $path = substr(json_encode($exception->getFile(), $options), 1, -1);
+ return $path . ':' . $exception->getLine();
+ }
+
+ /**
+ * @param \Exception|\Throwable $exception
+ *
+ * @param null|string $previous
+ *
+ * @return string
+ */
+ private function formatException($exception, $previous = null)
+ {
+ $formattedException =
+ '{"class":"' . get_class($exception) .
+ '","message":"' . $exception->getMessage() .
+ '","code":' . $exception->getCode() .
+ ',"file":"' . $this->formatExceptionFilePathWithLine($exception) .
+ ($previous ? '","previous":' . $previous : '"') .
+ '}';
+ return $formattedException;
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php
new file mode 100644
index 0000000..310d93c
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php
@@ -0,0 +1,222 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+/**
+ * @covers Monolog\Formatter\LineFormatter
+ */
+class LineFormatterTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDefFormatWithString()
+ {
+ $formatter = new LineFormatter(null, 'Y-m-d');
+ $message = $formatter->format(array(
+ 'level_name' => 'WARNING',
+ 'channel' => 'log',
+ 'context' => array(),
+ 'message' => 'foo',
+ 'datetime' => new \DateTime,
+ 'extra' => array(),
+ ));
+ $this->assertEquals('['.date('Y-m-d').'] log.WARNING: foo [] []'."\n", $message);
+ }
+
+ public function testDefFormatWithArrayContext()
+ {
+ $formatter = new LineFormatter(null, 'Y-m-d');
+ $message = $formatter->format(array(
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'message' => 'foo',
+ 'datetime' => new \DateTime,
+ 'extra' => array(),
+ 'context' => array(
+ 'foo' => 'bar',
+ 'baz' => 'qux',
+ 'bool' => false,
+ 'null' => null,
+ ),
+ ));
+ $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foo {"foo":"bar","baz":"qux","bool":false,"null":null} []'."\n", $message);
+ }
+
+ public function testDefFormatExtras()
+ {
+ $formatter = new LineFormatter(null, 'Y-m-d');
+ $message = $formatter->format(array(
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array(),
+ 'datetime' => new \DateTime,
+ 'extra' => array('ip' => '127.0.0.1'),
+ 'message' => 'log',
+ ));
+ $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log [] {"ip":"127.0.0.1"}'."\n", $message);
+ }
+
+ public function testFormatExtras()
+ {
+ $formatter = new LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra.file% %extra%\n", 'Y-m-d');
+ $message = $formatter->format(array(
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array(),
+ 'datetime' => new \DateTime,
+ 'extra' => array('ip' => '127.0.0.1', 'file' => 'test'),
+ 'message' => 'log',
+ ));
+ $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log [] test {"ip":"127.0.0.1"}'."\n", $message);
+ }
+
+ public function testContextAndExtraOptionallyNotShownIfEmpty()
+ {
+ $formatter = new LineFormatter(null, 'Y-m-d', false, true);
+ $message = $formatter->format(array(
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array(),
+ 'datetime' => new \DateTime,
+ 'extra' => array(),
+ 'message' => 'log',
+ ));
+ $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log '."\n", $message);
+ }
+
+ public function testContextAndExtraReplacement()
+ {
+ $formatter = new LineFormatter('%context.foo% => %extra.foo%');
+ $message = $formatter->format(array(
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('foo' => 'bar'),
+ 'datetime' => new \DateTime,
+ 'extra' => array('foo' => 'xbar'),
+ 'message' => 'log',
+ ));
+ $this->assertEquals('bar => xbar', $message);
+ }
+
+ public function testDefFormatWithObject()
+ {
+ $formatter = new LineFormatter(null, 'Y-m-d');
+ $message = $formatter->format(array(
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array(),
+ 'datetime' => new \DateTime,
+ 'extra' => array('foo' => new TestFoo, 'bar' => new TestBar, 'baz' => array(), 'res' => fopen('php://memory', 'rb')),
+ 'message' => 'foobar',
+ ));
+
+ $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foobar [] {"foo":"[object] (Monolog\\\\Formatter\\\\TestFoo: {\\"foo\\":\\"foo\\"})","bar":"[object] (Monolog\\\\Formatter\\\\TestBar: bar)","baz":[],"res":"[resource] (stream)"}'."\n", $message);
+ }
+
+ public function testDefFormatWithException()
+ {
+ $formatter = new LineFormatter(null, 'Y-m-d');
+ $message = $formatter->format(array(
+ 'level_name' => 'CRITICAL',
+ 'channel' => 'core',
+ 'context' => array('exception' => new \RuntimeException('Foo')),
+ 'datetime' => new \DateTime,
+ 'extra' => array(),
+ 'message' => 'foobar',
+ ));
+
+ $path = str_replace('\\/', '/', json_encode(__FILE__));
+
+ $this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr($path, 1, -1).':'.(__LINE__ - 8).')"} []'."\n", $message);
+ }
+
+ public function testDefFormatWithPreviousException()
+ {
+ $formatter = new LineFormatter(null, 'Y-m-d');
+ $previous = new \LogicException('Wut?');
+ $message = $formatter->format(array(
+ 'level_name' => 'CRITICAL',
+ 'channel' => 'core',
+ 'context' => array('exception' => new \RuntimeException('Foo', 0, $previous)),
+ 'datetime' => new \DateTime,
+ 'extra' => array(),
+ 'message' => 'foobar',
+ ));
+
+ $path = str_replace('\\/', '/', json_encode(__FILE__));
+
+ $this->assertEquals('['.date('Y-m-d').'] core.CRITICAL: foobar {"exception":"[object] (RuntimeException(code: 0): Foo at '.substr($path, 1, -1).':'.(__LINE__ - 8).', LogicException(code: 0): Wut? at '.substr($path, 1, -1).':'.(__LINE__ - 12).')"} []'."\n", $message);
+ }
+
+ public function testBatchFormat()
+ {
+ $formatter = new LineFormatter(null, 'Y-m-d');
+ $message = $formatter->formatBatch(array(
+ array(
+ 'level_name' => 'CRITICAL',
+ 'channel' => 'test',
+ 'message' => 'bar',
+ 'context' => array(),
+ 'datetime' => new \DateTime,
+ 'extra' => array(),
+ ),
+ array(
+ 'level_name' => 'WARNING',
+ 'channel' => 'log',
+ 'message' => 'foo',
+ 'context' => array(),
+ 'datetime' => new \DateTime,
+ 'extra' => array(),
+ ),
+ ));
+ $this->assertEquals('['.date('Y-m-d').'] test.CRITICAL: bar [] []'."\n".'['.date('Y-m-d').'] log.WARNING: foo [] []'."\n", $message);
+ }
+
+ public function testFormatShouldStripInlineLineBreaks()
+ {
+ $formatter = new LineFormatter(null, 'Y-m-d');
+ $message = $formatter->format(
+ array(
+ 'message' => "foo\nbar",
+ 'context' => array(),
+ 'extra' => array(),
+ )
+ );
+
+ $this->assertRegExp('/foo bar/', $message);
+ }
+
+ public function testFormatShouldNotStripInlineLineBreaksWhenFlagIsSet()
+ {
+ $formatter = new LineFormatter(null, 'Y-m-d', true);
+ $message = $formatter->format(
+ array(
+ 'message' => "foo\nbar",
+ 'context' => array(),
+ 'extra' => array(),
+ )
+ );
+
+ $this->assertRegExp('/foo\nbar/', $message);
+ }
+}
+
+class TestFoo
+{
+ public $foo = 'foo';
+}
+
+class TestBar
+{
+ public function __toString()
+ {
+ return 'bar';
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php
new file mode 100644
index 0000000..6d59b3f
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/LogglyFormatterTest.php
@@ -0,0 +1,40 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\TestCase;
+
+class LogglyFormatterTest extends TestCase
+{
+ /**
+ * @covers Monolog\Formatter\LogglyFormatter::__construct
+ */
+ public function testConstruct()
+ {
+ $formatter = new LogglyFormatter();
+ $this->assertEquals(LogglyFormatter::BATCH_MODE_NEWLINES, $formatter->getBatchMode());
+ $formatter = new LogglyFormatter(LogglyFormatter::BATCH_MODE_JSON);
+ $this->assertEquals(LogglyFormatter::BATCH_MODE_JSON, $formatter->getBatchMode());
+ }
+
+ /**
+ * @covers Monolog\Formatter\LogglyFormatter::format
+ */
+ public function testFormat()
+ {
+ $formatter = new LogglyFormatter();
+ $record = $this->getRecord();
+ $formatted_decoded = json_decode($formatter->format($record), true);
+ $this->assertArrayHasKey("timestamp", $formatted_decoded);
+ $this->assertEquals(new \DateTime($formatted_decoded["timestamp"]), $record["datetime"]);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php
new file mode 100644
index 0000000..9f6b1cc
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php
@@ -0,0 +1,333 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+
+class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
+{
+ public function tearDown()
+ {
+ \PHPUnit_Framework_Error_Warning::$enabled = true;
+
+ return parent::tearDown();
+ }
+
+ /**
+ * @covers Monolog\Formatter\LogstashFormatter::format
+ */
+ public function testDefaultFormatter()
+ {
+ $formatter = new LogstashFormatter('test', 'hostname');
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array(),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'log',
+ );
+
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertEquals("1970-01-01T00:00:00.000000+00:00", $message['@timestamp']);
+ $this->assertEquals('log', $message['@message']);
+ $this->assertEquals('meh', $message['@fields']['channel']);
+ $this->assertContains('meh', $message['@tags']);
+ $this->assertEquals(Logger::ERROR, $message['@fields']['level']);
+ $this->assertEquals('test', $message['@type']);
+ $this->assertEquals('hostname', $message['@source']);
+
+ $formatter = new LogstashFormatter('mysystem');
+
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertEquals('mysystem', $message['@type']);
+ }
+
+ /**
+ * @covers Monolog\Formatter\LogstashFormatter::format
+ */
+ public function testFormatWithFileAndLine()
+ {
+ $formatter = new LogstashFormatter('test');
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('file' => 'test', 'line' => 14),
+ 'message' => 'log',
+ );
+
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertEquals('test', $message['@fields']['file']);
+ $this->assertEquals(14, $message['@fields']['line']);
+ }
+
+ /**
+ * @covers Monolog\Formatter\LogstashFormatter::format
+ */
+ public function testFormatWithContext()
+ {
+ $formatter = new LogstashFormatter('test');
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('key' => 'pair'),
+ 'message' => 'log',
+ );
+
+ $message = json_decode($formatter->format($record), true);
+
+ $message_array = $message['@fields'];
+
+ $this->assertArrayHasKey('ctxt_from', $message_array);
+ $this->assertEquals('logger', $message_array['ctxt_from']);
+
+ // Test with extraPrefix
+ $formatter = new LogstashFormatter('test', null, null, 'CTX');
+ $message = json_decode($formatter->format($record), true);
+
+ $message_array = $message['@fields'];
+
+ $this->assertArrayHasKey('CTXfrom', $message_array);
+ $this->assertEquals('logger', $message_array['CTXfrom']);
+ }
+
+ /**
+ * @covers Monolog\Formatter\LogstashFormatter::format
+ */
+ public function testFormatWithExtra()
+ {
+ $formatter = new LogstashFormatter('test');
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('key' => 'pair'),
+ 'message' => 'log',
+ );
+
+ $message = json_decode($formatter->format($record), true);
+
+ $message_array = $message['@fields'];
+
+ $this->assertArrayHasKey('key', $message_array);
+ $this->assertEquals('pair', $message_array['key']);
+
+ // Test with extraPrefix
+ $formatter = new LogstashFormatter('test', null, 'EXT');
+ $message = json_decode($formatter->format($record), true);
+
+ $message_array = $message['@fields'];
+
+ $this->assertArrayHasKey('EXTkey', $message_array);
+ $this->assertEquals('pair', $message_array['EXTkey']);
+ }
+
+ public function testFormatWithApplicationName()
+ {
+ $formatter = new LogstashFormatter('app', 'test');
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('key' => 'pair'),
+ 'message' => 'log',
+ );
+
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertArrayHasKey('@type', $message);
+ $this->assertEquals('app', $message['@type']);
+ }
+
+ /**
+ * @covers Monolog\Formatter\LogstashFormatter::format
+ */
+ public function testDefaultFormatterV1()
+ {
+ $formatter = new LogstashFormatter('test', 'hostname', null, 'ctxt_', LogstashFormatter::V1);
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array(),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'log',
+ );
+
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertEquals("1970-01-01T00:00:00.000000+00:00", $message['@timestamp']);
+ $this->assertEquals("1", $message['@version']);
+ $this->assertEquals('log', $message['message']);
+ $this->assertEquals('meh', $message['channel']);
+ $this->assertEquals('ERROR', $message['level']);
+ $this->assertEquals('test', $message['type']);
+ $this->assertEquals('hostname', $message['host']);
+
+ $formatter = new LogstashFormatter('mysystem', null, null, 'ctxt_', LogstashFormatter::V1);
+
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertEquals('mysystem', $message['type']);
+ }
+
+ /**
+ * @covers Monolog\Formatter\LogstashFormatter::format
+ */
+ public function testFormatWithFileAndLineV1()
+ {
+ $formatter = new LogstashFormatter('test', null, null, 'ctxt_', LogstashFormatter::V1);
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('file' => 'test', 'line' => 14),
+ 'message' => 'log',
+ );
+
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertEquals('test', $message['file']);
+ $this->assertEquals(14, $message['line']);
+ }
+
+ /**
+ * @covers Monolog\Formatter\LogstashFormatter::format
+ */
+ public function testFormatWithContextV1()
+ {
+ $formatter = new LogstashFormatter('test', null, null, 'ctxt_', LogstashFormatter::V1);
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('key' => 'pair'),
+ 'message' => 'log',
+ );
+
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertArrayHasKey('ctxt_from', $message);
+ $this->assertEquals('logger', $message['ctxt_from']);
+
+ // Test with extraPrefix
+ $formatter = new LogstashFormatter('test', null, null, 'CTX', LogstashFormatter::V1);
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertArrayHasKey('CTXfrom', $message);
+ $this->assertEquals('logger', $message['CTXfrom']);
+ }
+
+ /**
+ * @covers Monolog\Formatter\LogstashFormatter::format
+ */
+ public function testFormatWithExtraV1()
+ {
+ $formatter = new LogstashFormatter('test', null, null, 'ctxt_', LogstashFormatter::V1);
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('key' => 'pair'),
+ 'message' => 'log',
+ );
+
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertArrayHasKey('key', $message);
+ $this->assertEquals('pair', $message['key']);
+
+ // Test with extraPrefix
+ $formatter = new LogstashFormatter('test', null, 'EXT', 'ctxt_', LogstashFormatter::V1);
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertArrayHasKey('EXTkey', $message);
+ $this->assertEquals('pair', $message['EXTkey']);
+ }
+
+ public function testFormatWithApplicationNameV1()
+ {
+ $formatter = new LogstashFormatter('app', 'test', null, 'ctxt_', LogstashFormatter::V1);
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('key' => 'pair'),
+ 'message' => 'log',
+ );
+
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertArrayHasKey('type', $message);
+ $this->assertEquals('app', $message['type']);
+ }
+
+ public function testFormatWithLatin9Data()
+ {
+ if (version_compare(PHP_VERSION, '5.5.0', '<')) {
+ // Ignore the warning that will be emitted by PHP <5.5.0
+ \PHPUnit_Framework_Error_Warning::$enabled = false;
+ }
+ $formatter = new LogstashFormatter('test', 'hostname');
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => '¯\_(ツ)_/¯',
+ 'context' => array(),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(
+ 'user_agent' => "\xD6WN; FBCR/OrangeEspa\xF1a; Vers\xE3o/4.0; F\xE4rist",
+ ),
+ 'message' => 'log',
+ );
+
+ $message = json_decode($formatter->format($record), true);
+
+ $this->assertEquals("1970-01-01T00:00:00.000000+00:00", $message['@timestamp']);
+ $this->assertEquals('log', $message['@message']);
+ $this->assertEquals('¯\_(ツ)_/¯', $message['@fields']['channel']);
+ $this->assertContains('¯\_(ツ)_/¯', $message['@tags']);
+ $this->assertEquals(Logger::ERROR, $message['@fields']['level']);
+ $this->assertEquals('test', $message['@type']);
+ $this->assertEquals('hostname', $message['@source']);
+ if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
+ $this->assertEquals('ÖWN; FBCR/OrangeEspaña; Versão/4.0; Färist', $message['@fields']['user_agent']);
+ } else {
+ // PHP <5.5 does not return false for an element encoding failure,
+ // instead it emits a warning (possibly) and nulls the value.
+ $this->assertEquals(null, $message['@fields']['user_agent']);
+ }
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php
new file mode 100644
index 0000000..52e699e
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php
@@ -0,0 +1,262 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+
+/**
+ * @author Florian Plattner
+ */
+class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ if (!class_exists('MongoDate')) {
+ $this->markTestSkipped('mongo extension not installed');
+ }
+ }
+
+ public function constructArgumentProvider()
+ {
+ return array(
+ array(1, true, 1, true),
+ array(0, false, 0, false),
+ );
+ }
+
+ /**
+ * @param $traceDepth
+ * @param $traceAsString
+ * @param $expectedTraceDepth
+ * @param $expectedTraceAsString
+ *
+ * @dataProvider constructArgumentProvider
+ */
+ public function testConstruct($traceDepth, $traceAsString, $expectedTraceDepth, $expectedTraceAsString)
+ {
+ $formatter = new MongoDBFormatter($traceDepth, $traceAsString);
+
+ $reflTrace = new \ReflectionProperty($formatter, 'exceptionTraceAsString');
+ $reflTrace->setAccessible(true);
+ $this->assertEquals($expectedTraceAsString, $reflTrace->getValue($formatter));
+
+ $reflDepth = new\ReflectionProperty($formatter, 'maxNestingLevel');
+ $reflDepth->setAccessible(true);
+ $this->assertEquals($expectedTraceDepth, $reflDepth->getValue($formatter));
+ }
+
+ public function testSimpleFormat()
+ {
+ $record = array(
+ 'message' => 'some log message',
+ 'context' => array(),
+ 'level' => Logger::WARNING,
+ 'level_name' => Logger::getLevelName(Logger::WARNING),
+ 'channel' => 'test',
+ 'datetime' => new \DateTime('2014-02-01 00:00:00'),
+ 'extra' => array(),
+ );
+
+ $formatter = new MongoDBFormatter();
+ $formattedRecord = $formatter->format($record);
+
+ $this->assertCount(7, $formattedRecord);
+ $this->assertEquals('some log message', $formattedRecord['message']);
+ $this->assertEquals(array(), $formattedRecord['context']);
+ $this->assertEquals(Logger::WARNING, $formattedRecord['level']);
+ $this->assertEquals(Logger::getLevelName(Logger::WARNING), $formattedRecord['level_name']);
+ $this->assertEquals('test', $formattedRecord['channel']);
+ $this->assertInstanceOf('\MongoDate', $formattedRecord['datetime']);
+ $this->assertEquals('0.00000000 1391212800', $formattedRecord['datetime']->__toString());
+ $this->assertEquals(array(), $formattedRecord['extra']);
+ }
+
+ public function testRecursiveFormat()
+ {
+ $someObject = new \stdClass();
+ $someObject->foo = 'something';
+ $someObject->bar = 'stuff';
+
+ $record = array(
+ 'message' => 'some log message',
+ 'context' => array(
+ 'stuff' => new \DateTime('2014-02-01 02:31:33'),
+ 'some_object' => $someObject,
+ 'context_string' => 'some string',
+ 'context_int' => 123456,
+ 'except' => new \Exception('exception message', 987),
+ ),
+ 'level' => Logger::WARNING,
+ 'level_name' => Logger::getLevelName(Logger::WARNING),
+ 'channel' => 'test',
+ 'datetime' => new \DateTime('2014-02-01 00:00:00'),
+ 'extra' => array(),
+ );
+
+ $formatter = new MongoDBFormatter();
+ $formattedRecord = $formatter->format($record);
+
+ $this->assertCount(5, $formattedRecord['context']);
+ $this->assertInstanceOf('\MongoDate', $formattedRecord['context']['stuff']);
+ $this->assertEquals('0.00000000 1391221893', $formattedRecord['context']['stuff']->__toString());
+ $this->assertEquals(
+ array(
+ 'foo' => 'something',
+ 'bar' => 'stuff',
+ 'class' => 'stdClass',
+ ),
+ $formattedRecord['context']['some_object']
+ );
+ $this->assertEquals('some string', $formattedRecord['context']['context_string']);
+ $this->assertEquals(123456, $formattedRecord['context']['context_int']);
+
+ $this->assertCount(5, $formattedRecord['context']['except']);
+ $this->assertEquals('exception message', $formattedRecord['context']['except']['message']);
+ $this->assertEquals(987, $formattedRecord['context']['except']['code']);
+ $this->assertInternalType('string', $formattedRecord['context']['except']['file']);
+ $this->assertInternalType('integer', $formattedRecord['context']['except']['code']);
+ $this->assertInternalType('string', $formattedRecord['context']['except']['trace']);
+ $this->assertEquals('Exception', $formattedRecord['context']['except']['class']);
+ }
+
+ public function testFormatDepthArray()
+ {
+ $record = array(
+ 'message' => 'some log message',
+ 'context' => array(
+ 'nest2' => array(
+ 'property' => 'anything',
+ 'nest3' => array(
+ 'nest4' => 'value',
+ 'property' => 'nothing',
+ ),
+ ),
+ ),
+ 'level' => Logger::WARNING,
+ 'level_name' => Logger::getLevelName(Logger::WARNING),
+ 'channel' => 'test',
+ 'datetime' => new \DateTime('2014-02-01 00:00:00'),
+ 'extra' => array(),
+ );
+
+ $formatter = new MongoDBFormatter(2);
+ $formattedResult = $formatter->format($record);
+
+ $this->assertEquals(
+ array(
+ 'nest2' => array(
+ 'property' => 'anything',
+ 'nest3' => '[...]',
+ ),
+ ),
+ $formattedResult['context']
+ );
+ }
+
+ public function testFormatDepthArrayInfiniteNesting()
+ {
+ $record = array(
+ 'message' => 'some log message',
+ 'context' => array(
+ 'nest2' => array(
+ 'property' => 'something',
+ 'nest3' => array(
+ 'property' => 'anything',
+ 'nest4' => array(
+ 'property' => 'nothing',
+ ),
+ ),
+ ),
+ ),
+ 'level' => Logger::WARNING,
+ 'level_name' => Logger::getLevelName(Logger::WARNING),
+ 'channel' => 'test',
+ 'datetime' => new \DateTime('2014-02-01 00:00:00'),
+ 'extra' => array(),
+ );
+
+ $formatter = new MongoDBFormatter(0);
+ $formattedResult = $formatter->format($record);
+
+ $this->assertEquals(
+ array(
+ 'nest2' => array(
+ 'property' => 'something',
+ 'nest3' => array(
+ 'property' => 'anything',
+ 'nest4' => array(
+ 'property' => 'nothing',
+ ),
+ ),
+ ),
+ ),
+ $formattedResult['context']
+ );
+ }
+
+ public function testFormatDepthObjects()
+ {
+ $someObject = new \stdClass();
+ $someObject->property = 'anything';
+ $someObject->nest3 = new \stdClass();
+ $someObject->nest3->property = 'nothing';
+ $someObject->nest3->nest4 = 'invisible';
+
+ $record = array(
+ 'message' => 'some log message',
+ 'context' => array(
+ 'nest2' => $someObject,
+ ),
+ 'level' => Logger::WARNING,
+ 'level_name' => Logger::getLevelName(Logger::WARNING),
+ 'channel' => 'test',
+ 'datetime' => new \DateTime('2014-02-01 00:00:00'),
+ 'extra' => array(),
+ );
+
+ $formatter = new MongoDBFormatter(2, true);
+ $formattedResult = $formatter->format($record);
+
+ $this->assertEquals(
+ array(
+ 'nest2' => array(
+ 'property' => 'anything',
+ 'nest3' => '[...]',
+ 'class' => 'stdClass',
+ ),
+ ),
+ $formattedResult['context']
+ );
+ }
+
+ public function testFormatDepthException()
+ {
+ $record = array(
+ 'message' => 'some log message',
+ 'context' => array(
+ 'nest2' => new \Exception('exception message', 987),
+ ),
+ 'level' => Logger::WARNING,
+ 'level_name' => Logger::getLevelName(Logger::WARNING),
+ 'channel' => 'test',
+ 'datetime' => new \DateTime('2014-02-01 00:00:00'),
+ 'extra' => array(),
+ );
+
+ $formatter = new MongoDBFormatter(2, false);
+ $formattedRecord = $formatter->format($record);
+
+ $this->assertEquals('exception message', $formattedRecord['context']['nest2']['message']);
+ $this->assertEquals(987, $formattedRecord['context']['nest2']['code']);
+ $this->assertEquals('[...]', $formattedRecord['context']['nest2']['trace']);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php
new file mode 100644
index 0000000..57bcdf9
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php
@@ -0,0 +1,423 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+/**
+ * @covers Monolog\Formatter\NormalizerFormatter
+ */
+class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
+{
+ public function tearDown()
+ {
+ \PHPUnit_Framework_Error_Warning::$enabled = true;
+
+ return parent::tearDown();
+ }
+
+ public function testFormat()
+ {
+ $formatter = new NormalizerFormatter('Y-m-d');
+ $formatted = $formatter->format(array(
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'message' => 'foo',
+ 'datetime' => new \DateTime,
+ 'extra' => array('foo' => new TestFooNorm, 'bar' => new TestBarNorm, 'baz' => array(), 'res' => fopen('php://memory', 'rb')),
+ 'context' => array(
+ 'foo' => 'bar',
+ 'baz' => 'qux',
+ 'inf' => INF,
+ '-inf' => -INF,
+ 'nan' => acos(4),
+ ),
+ ));
+
+ $this->assertEquals(array(
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'message' => 'foo',
+ 'datetime' => date('Y-m-d'),
+ 'extra' => array(
+ 'foo' => '[object] (Monolog\\Formatter\\TestFooNorm: {"foo":"foo"})',
+ 'bar' => '[object] (Monolog\\Formatter\\TestBarNorm: bar)',
+ 'baz' => array(),
+ 'res' => '[resource] (stream)',
+ ),
+ 'context' => array(
+ 'foo' => 'bar',
+ 'baz' => 'qux',
+ 'inf' => 'INF',
+ '-inf' => '-INF',
+ 'nan' => 'NaN',
+ ),
+ ), $formatted);
+ }
+
+ public function testFormatExceptions()
+ {
+ $formatter = new NormalizerFormatter('Y-m-d');
+ $e = new \LogicException('bar');
+ $e2 = new \RuntimeException('foo', 0, $e);
+ $formatted = $formatter->format(array(
+ 'exception' => $e2,
+ ));
+
+ $this->assertGreaterThan(5, count($formatted['exception']['trace']));
+ $this->assertTrue(isset($formatted['exception']['previous']));
+ unset($formatted['exception']['trace'], $formatted['exception']['previous']);
+
+ $this->assertEquals(array(
+ 'exception' => array(
+ 'class' => get_class($e2),
+ 'message' => $e2->getMessage(),
+ 'code' => $e2->getCode(),
+ 'file' => $e2->getFile().':'.$e2->getLine(),
+ ),
+ ), $formatted);
+ }
+
+ public function testFormatSoapFaultException()
+ {
+ if (!class_exists('SoapFault')) {
+ $this->markTestSkipped('Requires the soap extension');
+ }
+
+ $formatter = new NormalizerFormatter('Y-m-d');
+ $e = new \SoapFault('foo', 'bar', 'hello', 'world');
+ $formatted = $formatter->format(array(
+ 'exception' => $e,
+ ));
+
+ unset($formatted['exception']['trace']);
+
+ $this->assertEquals(array(
+ 'exception' => array(
+ 'class' => 'SoapFault',
+ 'message' => 'bar',
+ 'code' => 0,
+ 'file' => $e->getFile().':'.$e->getLine(),
+ 'faultcode' => 'foo',
+ 'faultactor' => 'hello',
+ 'detail' => 'world',
+ ),
+ ), $formatted);
+ }
+
+ public function testFormatToStringExceptionHandle()
+ {
+ $formatter = new NormalizerFormatter('Y-m-d');
+ $this->setExpectedException('RuntimeException', 'Could not convert to string');
+ $formatter->format(array(
+ 'myObject' => new TestToStringError(),
+ ));
+ }
+
+ public function testBatchFormat()
+ {
+ $formatter = new NormalizerFormatter('Y-m-d');
+ $formatted = $formatter->formatBatch(array(
+ array(
+ 'level_name' => 'CRITICAL',
+ 'channel' => 'test',
+ 'message' => 'bar',
+ 'context' => array(),
+ 'datetime' => new \DateTime,
+ 'extra' => array(),
+ ),
+ array(
+ 'level_name' => 'WARNING',
+ 'channel' => 'log',
+ 'message' => 'foo',
+ 'context' => array(),
+ 'datetime' => new \DateTime,
+ 'extra' => array(),
+ ),
+ ));
+ $this->assertEquals(array(
+ array(
+ 'level_name' => 'CRITICAL',
+ 'channel' => 'test',
+ 'message' => 'bar',
+ 'context' => array(),
+ 'datetime' => date('Y-m-d'),
+ 'extra' => array(),
+ ),
+ array(
+ 'level_name' => 'WARNING',
+ 'channel' => 'log',
+ 'message' => 'foo',
+ 'context' => array(),
+ 'datetime' => date('Y-m-d'),
+ 'extra' => array(),
+ ),
+ ), $formatted);
+ }
+
+ /**
+ * Test issue #137
+ */
+ public function testIgnoresRecursiveObjectReferences()
+ {
+ // set up the recursion
+ $foo = new \stdClass();
+ $bar = new \stdClass();
+
+ $foo->bar = $bar;
+ $bar->foo = $foo;
+
+ // set an error handler to assert that the error is not raised anymore
+ $that = $this;
+ set_error_handler(function ($level, $message, $file, $line, $context) use ($that) {
+ if (error_reporting() & $level) {
+ restore_error_handler();
+ $that->fail("$message should not be raised");
+ }
+ });
+
+ $formatter = new NormalizerFormatter();
+ $reflMethod = new \ReflectionMethod($formatter, 'toJson');
+ $reflMethod->setAccessible(true);
+ $res = $reflMethod->invoke($formatter, array($foo, $bar), true);
+
+ restore_error_handler();
+
+ $this->assertEquals(@json_encode(array($foo, $bar)), $res);
+ }
+
+ public function testIgnoresInvalidTypes()
+ {
+ // set up the recursion
+ $resource = fopen(__FILE__, 'r');
+
+ // set an error handler to assert that the error is not raised anymore
+ $that = $this;
+ set_error_handler(function ($level, $message, $file, $line, $context) use ($that) {
+ if (error_reporting() & $level) {
+ restore_error_handler();
+ $that->fail("$message should not be raised");
+ }
+ });
+
+ $formatter = new NormalizerFormatter();
+ $reflMethod = new \ReflectionMethod($formatter, 'toJson');
+ $reflMethod->setAccessible(true);
+ $res = $reflMethod->invoke($formatter, array($resource), true);
+
+ restore_error_handler();
+
+ $this->assertEquals(@json_encode(array($resource)), $res);
+ }
+
+ public function testNormalizeHandleLargeArrays()
+ {
+ $formatter = new NormalizerFormatter();
+ $largeArray = range(1, 2000);
+
+ $res = $formatter->format(array(
+ 'level_name' => 'CRITICAL',
+ 'channel' => 'test',
+ 'message' => 'bar',
+ 'context' => array($largeArray),
+ 'datetime' => new \DateTime,
+ 'extra' => array(),
+ ));
+
+ $this->assertCount(1000, $res['context'][0]);
+ $this->assertEquals('Over 1000 items (2000 total), aborting normalization', $res['context'][0]['...']);
+ }
+
+ /**
+ * @expectedException RuntimeException
+ */
+ public function testThrowsOnInvalidEncoding()
+ {
+ if (version_compare(PHP_VERSION, '5.5.0', '<')) {
+ // Ignore the warning that will be emitted by PHP <5.5.0
+ \PHPUnit_Framework_Error_Warning::$enabled = false;
+ }
+ $formatter = new NormalizerFormatter();
+ $reflMethod = new \ReflectionMethod($formatter, 'toJson');
+ $reflMethod->setAccessible(true);
+
+ // send an invalid unicode sequence as a object that can't be cleaned
+ $record = new \stdClass;
+ $record->message = "\xB1\x31";
+ $res = $reflMethod->invoke($formatter, $record);
+ if (PHP_VERSION_ID < 50500 && $res === '{"message":null}') {
+ throw new \RuntimeException('PHP 5.3/5.4 throw a warning and null the value instead of returning false entirely');
+ }
+ }
+
+ public function testConvertsInvalidEncodingAsLatin9()
+ {
+ if (version_compare(PHP_VERSION, '5.5.0', '<')) {
+ // Ignore the warning that will be emitted by PHP <5.5.0
+ \PHPUnit_Framework_Error_Warning::$enabled = false;
+ }
+ $formatter = new NormalizerFormatter();
+ $reflMethod = new \ReflectionMethod($formatter, 'toJson');
+ $reflMethod->setAccessible(true);
+
+ $res = $reflMethod->invoke($formatter, array('message' => "\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE"));
+
+ if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
+ $this->assertSame('{"message":"€ŠšŽžŒœŸ"}', $res);
+ } else {
+ // PHP <5.5 does not return false for an element encoding failure,
+ // instead it emits a warning (possibly) and nulls the value.
+ $this->assertSame('{"message":null}', $res);
+ }
+ }
+
+ /**
+ * @param mixed $in Input
+ * @param mixed $expect Expected output
+ * @covers Monolog\Formatter\NormalizerFormatter::detectAndCleanUtf8
+ * @dataProvider providesDetectAndCleanUtf8
+ */
+ public function testDetectAndCleanUtf8($in, $expect)
+ {
+ $formatter = new NormalizerFormatter();
+ $formatter->detectAndCleanUtf8($in);
+ $this->assertSame($expect, $in);
+ }
+
+ public function providesDetectAndCleanUtf8()
+ {
+ $obj = new \stdClass;
+
+ return array(
+ 'null' => array(null, null),
+ 'int' => array(123, 123),
+ 'float' => array(123.45, 123.45),
+ 'bool false' => array(false, false),
+ 'bool true' => array(true, true),
+ 'ascii string' => array('abcdef', 'abcdef'),
+ 'latin9 string' => array("\xB1\x31\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE\xFF", '±1€ŠšŽžŒœŸÿ'),
+ 'unicode string' => array('¤¦¨´¸¼½¾€ŠšŽžŒœŸ', '¤¦¨´¸¼½¾€ŠšŽžŒœŸ'),
+ 'empty array' => array(array(), array()),
+ 'array' => array(array('abcdef'), array('abcdef')),
+ 'object' => array($obj, $obj),
+ );
+ }
+
+ /**
+ * @param int $code
+ * @param string $msg
+ * @dataProvider providesHandleJsonErrorFailure
+ */
+ public function testHandleJsonErrorFailure($code, $msg)
+ {
+ $formatter = new NormalizerFormatter();
+ $reflMethod = new \ReflectionMethod($formatter, 'handleJsonError');
+ $reflMethod->setAccessible(true);
+
+ $this->setExpectedException('RuntimeException', $msg);
+ $reflMethod->invoke($formatter, $code, 'faked');
+ }
+
+ public function providesHandleJsonErrorFailure()
+ {
+ return array(
+ 'depth' => array(JSON_ERROR_DEPTH, 'Maximum stack depth exceeded'),
+ 'state' => array(JSON_ERROR_STATE_MISMATCH, 'Underflow or the modes mismatch'),
+ 'ctrl' => array(JSON_ERROR_CTRL_CHAR, 'Unexpected control character found'),
+ 'default' => array(-1, 'Unknown error'),
+ );
+ }
+
+ public function testExceptionTraceWithArgs()
+ {
+ if (defined('HHVM_VERSION')) {
+ $this->markTestSkipped('Not supported in HHVM since it detects errors differently');
+ }
+
+ // This happens i.e. in React promises or Guzzle streams where stream wrappers are registered
+ // and no file or line are included in the trace because it's treated as internal function
+ set_error_handler(function ($errno, $errstr, $errfile, $errline) {
+ throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
+ });
+
+ try {
+ // This will contain $resource and $wrappedResource as arguments in the trace item
+ $resource = fopen('php://memory', 'rw+');
+ fwrite($resource, 'test_resource');
+ $wrappedResource = new TestFooNorm;
+ $wrappedResource->foo = $resource;
+ // Just do something stupid with a resource/wrapped resource as argument
+ array_keys($wrappedResource);
+ } catch (\Exception $e) {
+ restore_error_handler();
+ }
+
+ $formatter = new NormalizerFormatter();
+ $record = array('context' => array('exception' => $e));
+ $result = $formatter->format($record);
+
+ $this->assertRegExp(
+ '%"resource":"\[resource\] \(stream\)"%',
+ $result['context']['exception']['trace'][0]
+ );
+
+ if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
+ $pattern = '%"wrappedResource":"\[object\] \(Monolog\\\\\\\\Formatter\\\\\\\\TestFooNorm: \)"%';
+ } else {
+ $pattern = '%\\\\"foo\\\\":null%';
+ }
+
+ // Tests that the wrapped resource is ignored while encoding, only works for PHP <= 5.4
+ $this->assertRegExp(
+ $pattern,
+ $result['context']['exception']['trace'][0]
+ );
+ }
+}
+
+class TestFooNorm
+{
+ public $foo = 'foo';
+}
+
+class TestBarNorm
+{
+ public function __toString()
+ {
+ return 'bar';
+ }
+}
+
+class TestStreamFoo
+{
+ public $foo;
+ public $resource;
+
+ public function __construct($resource)
+ {
+ $this->resource = $resource;
+ $this->foo = 'BAR';
+ }
+
+ public function __toString()
+ {
+ fseek($this->resource, 0);
+
+ return $this->foo . ' - ' . (string) stream_get_contents($this->resource);
+ }
+}
+
+class TestToStringError
+{
+ public function __toString()
+ {
+ throw new \RuntimeException('Could not convert to string');
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php
new file mode 100644
index 0000000..b1c8fd4
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php
@@ -0,0 +1,110 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
+{
+ private $formatter;
+
+ public function setUp()
+ {
+ $this->formatter = new ScalarFormatter();
+ }
+
+ public function buildTrace(\Exception $e)
+ {
+ $data = array();
+ $trace = $e->getTrace();
+ foreach ($trace as $frame) {
+ if (isset($frame['file'])) {
+ $data[] = $frame['file'].':'.$frame['line'];
+ } else {
+ $data[] = json_encode($frame);
+ }
+ }
+
+ return $data;
+ }
+
+ public function encodeJson($data)
+ {
+ if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
+ return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
+ }
+
+ return json_encode($data);
+ }
+
+ public function testFormat()
+ {
+ $exception = new \Exception('foo');
+ $formatted = $this->formatter->format(array(
+ 'foo' => 'string',
+ 'bar' => 1,
+ 'baz' => false,
+ 'bam' => array(1, 2, 3),
+ 'bat' => array('foo' => 'bar'),
+ 'bap' => \DateTime::createFromFormat(\DateTime::ISO8601, '1970-01-01T00:00:00+0000'),
+ 'ban' => $exception,
+ ));
+
+ $this->assertSame(array(
+ 'foo' => 'string',
+ 'bar' => 1,
+ 'baz' => false,
+ 'bam' => $this->encodeJson(array(1, 2, 3)),
+ 'bat' => $this->encodeJson(array('foo' => 'bar')),
+ 'bap' => '1970-01-01 00:00:00',
+ 'ban' => $this->encodeJson(array(
+ 'class' => get_class($exception),
+ 'message' => $exception->getMessage(),
+ 'code' => $exception->getCode(),
+ 'file' => $exception->getFile() . ':' . $exception->getLine(),
+ 'trace' => $this->buildTrace($exception),
+ )),
+ ), $formatted);
+ }
+
+ public function testFormatWithErrorContext()
+ {
+ $context = array('file' => 'foo', 'line' => 1);
+ $formatted = $this->formatter->format(array(
+ 'context' => $context,
+ ));
+
+ $this->assertSame(array(
+ 'context' => $this->encodeJson($context),
+ ), $formatted);
+ }
+
+ public function testFormatWithExceptionContext()
+ {
+ $exception = new \Exception('foo');
+ $formatted = $this->formatter->format(array(
+ 'context' => array(
+ 'exception' => $exception,
+ ),
+ ));
+
+ $this->assertSame(array(
+ 'context' => $this->encodeJson(array(
+ 'exception' => array(
+ 'class' => get_class($exception),
+ 'message' => $exception->getMessage(),
+ 'code' => $exception->getCode(),
+ 'file' => $exception->getFile() . ':' . $exception->getLine(),
+ 'trace' => $this->buildTrace($exception),
+ ),
+ )),
+ ), $formatted);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php b/vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php
new file mode 100644
index 0000000..52f15a3
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php
@@ -0,0 +1,142 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Formatter;
+
+use Monolog\Logger;
+
+class WildfireFormatterTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @covers Monolog\Formatter\WildfireFormatter::format
+ */
+ public function testDefaultFormat()
+ {
+ $wildfire = new WildfireFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('ip' => '127.0.0.1'),
+ 'message' => 'log',
+ );
+
+ $message = $wildfire->format($record);
+
+ $this->assertEquals(
+ '125|[{"Type":"ERROR","File":"","Line":"","Label":"meh"},'
+ .'{"message":"log","context":{"from":"logger"},"extra":{"ip":"127.0.0.1"}}]|',
+ $message
+ );
+ }
+
+ /**
+ * @covers Monolog\Formatter\WildfireFormatter::format
+ */
+ public function testFormatWithFileAndLine()
+ {
+ $wildfire = new WildfireFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('from' => 'logger'),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array('ip' => '127.0.0.1', 'file' => 'test', 'line' => 14),
+ 'message' => 'log',
+ );
+
+ $message = $wildfire->format($record);
+
+ $this->assertEquals(
+ '129|[{"Type":"ERROR","File":"test","Line":14,"Label":"meh"},'
+ .'{"message":"log","context":{"from":"logger"},"extra":{"ip":"127.0.0.1"}}]|',
+ $message
+ );
+ }
+
+ /**
+ * @covers Monolog\Formatter\WildfireFormatter::format
+ */
+ public function testFormatWithoutContext()
+ {
+ $wildfire = new WildfireFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array(),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'log',
+ );
+
+ $message = $wildfire->format($record);
+
+ $this->assertEquals(
+ '58|[{"Type":"ERROR","File":"","Line":"","Label":"meh"},"log"]|',
+ $message
+ );
+ }
+
+ /**
+ * @covers Monolog\Formatter\WildfireFormatter::formatBatch
+ * @expectedException BadMethodCallException
+ */
+ public function testBatchFormatThrowException()
+ {
+ $wildfire = new WildfireFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array(),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'log',
+ );
+
+ $wildfire->formatBatch(array($record));
+ }
+
+ /**
+ * @covers Monolog\Formatter\WildfireFormatter::format
+ */
+ public function testTableFormat()
+ {
+ $wildfire = new WildfireFormatter();
+ $record = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'table-channel',
+ 'context' => array(
+ WildfireFormatter::TABLE => array(
+ array('col1', 'col2', 'col3'),
+ array('val1', 'val2', 'val3'),
+ array('foo1', 'foo2', 'foo3'),
+ array('bar1', 'bar2', 'bar3'),
+ ),
+ ),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'table-message',
+ );
+
+ $message = $wildfire->format($record);
+
+ $this->assertEquals(
+ '171|[{"Type":"TABLE","File":"","Line":"","Label":"table-channel: table-message"},[["col1","col2","col3"],["val1","val2","val3"],["foo1","foo2","foo3"],["bar1","bar2","bar3"]]]|',
+ $message
+ );
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php
new file mode 100644
index 0000000..568eb9d
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/AbstractHandlerTest.php
@@ -0,0 +1,115 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+use Monolog\Formatter\LineFormatter;
+use Monolog\Processor\WebProcessor;
+
+class AbstractHandlerTest extends TestCase
+{
+ /**
+ * @covers Monolog\Handler\AbstractHandler::__construct
+ * @covers Monolog\Handler\AbstractHandler::getLevel
+ * @covers Monolog\Handler\AbstractHandler::setLevel
+ * @covers Monolog\Handler\AbstractHandler::getBubble
+ * @covers Monolog\Handler\AbstractHandler::setBubble
+ * @covers Monolog\Handler\AbstractHandler::getFormatter
+ * @covers Monolog\Handler\AbstractHandler::setFormatter
+ */
+ public function testConstructAndGetSet()
+ {
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array(Logger::WARNING, false));
+ $this->assertEquals(Logger::WARNING, $handler->getLevel());
+ $this->assertEquals(false, $handler->getBubble());
+
+ $handler->setLevel(Logger::ERROR);
+ $handler->setBubble(true);
+ $handler->setFormatter($formatter = new LineFormatter);
+ $this->assertEquals(Logger::ERROR, $handler->getLevel());
+ $this->assertEquals(true, $handler->getBubble());
+ $this->assertSame($formatter, $handler->getFormatter());
+ }
+
+ /**
+ * @covers Monolog\Handler\AbstractHandler::handleBatch
+ */
+ public function testHandleBatch()
+ {
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler');
+ $handler->expects($this->exactly(2))
+ ->method('handle');
+ $handler->handleBatch(array($this->getRecord(), $this->getRecord()));
+ }
+
+ /**
+ * @covers Monolog\Handler\AbstractHandler::isHandling
+ */
+ public function testIsHandling()
+ {
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array(Logger::WARNING, false));
+ $this->assertTrue($handler->isHandling($this->getRecord()));
+ $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG)));
+ }
+
+ /**
+ * @covers Monolog\Handler\AbstractHandler::__construct
+ */
+ public function testHandlesPsrStyleLevels()
+ {
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler', array('warning', false));
+ $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG)));
+ $handler->setLevel('debug');
+ $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG)));
+ }
+
+ /**
+ * @covers Monolog\Handler\AbstractHandler::getFormatter
+ * @covers Monolog\Handler\AbstractHandler::getDefaultFormatter
+ */
+ public function testGetFormatterInitializesDefault()
+ {
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler');
+ $this->assertInstanceOf('Monolog\Formatter\LineFormatter', $handler->getFormatter());
+ }
+
+ /**
+ * @covers Monolog\Handler\AbstractHandler::pushProcessor
+ * @covers Monolog\Handler\AbstractHandler::popProcessor
+ * @expectedException LogicException
+ */
+ public function testPushPopProcessor()
+ {
+ $logger = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler');
+ $processor1 = new WebProcessor;
+ $processor2 = new WebProcessor;
+
+ $logger->pushProcessor($processor1);
+ $logger->pushProcessor($processor2);
+
+ $this->assertEquals($processor2, $logger->popProcessor());
+ $this->assertEquals($processor1, $logger->popProcessor());
+ $logger->popProcessor();
+ }
+
+ /**
+ * @covers Monolog\Handler\AbstractHandler::pushProcessor
+ * @expectedException InvalidArgumentException
+ */
+ public function testPushProcessorWithNonCallable()
+ {
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractHandler');
+
+ $handler->pushProcessor(new \stdClass());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php
new file mode 100644
index 0000000..24d4f63
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php
@@ -0,0 +1,80 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+use Monolog\Processor\WebProcessor;
+
+class AbstractProcessingHandlerTest extends TestCase
+{
+ /**
+ * @covers Monolog\Handler\AbstractProcessingHandler::handle
+ */
+ public function testHandleLowerLevelMessage()
+ {
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, true));
+ $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
+ }
+
+ /**
+ * @covers Monolog\Handler\AbstractProcessingHandler::handle
+ */
+ public function testHandleBubbling()
+ {
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, true));
+ $this->assertFalse($handler->handle($this->getRecord()));
+ }
+
+ /**
+ * @covers Monolog\Handler\AbstractProcessingHandler::handle
+ */
+ public function testHandleNotBubbling()
+ {
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, false));
+ $this->assertTrue($handler->handle($this->getRecord()));
+ }
+
+ /**
+ * @covers Monolog\Handler\AbstractProcessingHandler::handle
+ */
+ public function testHandleIsFalseWhenNotHandled()
+ {
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, false));
+ $this->assertTrue($handler->handle($this->getRecord()));
+ $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
+ }
+
+ /**
+ * @covers Monolog\Handler\AbstractProcessingHandler::processRecord
+ */
+ public function testProcessRecord()
+ {
+ $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler');
+ $handler->pushProcessor(new WebProcessor(array(
+ 'REQUEST_URI' => '',
+ 'REQUEST_METHOD' => '',
+ 'REMOTE_ADDR' => '',
+ 'SERVER_NAME' => '',
+ 'UNIQUE_ID' => '',
+ )));
+ $handledRecord = null;
+ $handler->expects($this->once())
+ ->method('write')
+ ->will($this->returnCallback(function ($record) use (&$handledRecord) {
+ $handledRecord = $record;
+ }))
+ ;
+ $handler->handle($this->getRecord());
+ $this->assertEquals(6, count($handledRecord['extra']));
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php
new file mode 100644
index 0000000..8e0e723
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php
@@ -0,0 +1,136 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+use PhpAmqpLib\Message\AMQPMessage;
+use PhpAmqpLib\Connection\AMQPConnection;
+
+/**
+ * @covers Monolog\Handler\RotatingFileHandler
+ */
+class AmqpHandlerTest extends TestCase
+{
+ public function testHandleAmqpExt()
+ {
+ if (!class_exists('AMQPConnection') || !class_exists('AMQPExchange')) {
+ $this->markTestSkipped("amqp-php not installed");
+ }
+
+ if (!class_exists('AMQPChannel')) {
+ $this->markTestSkipped("Please update AMQP to version >= 1.0");
+ }
+
+ $messages = array();
+
+ $exchange = $this->getMock('AMQPExchange', array('publish', 'setName'), array(), '', false);
+ $exchange->expects($this->once())
+ ->method('setName')
+ ->with('log')
+ ;
+ $exchange->expects($this->any())
+ ->method('publish')
+ ->will($this->returnCallback(function ($message, $routing_key, $flags = 0, $attributes = array()) use (&$messages) {
+ $messages[] = array($message, $routing_key, $flags, $attributes);
+ }))
+ ;
+
+ $handler = new AmqpHandler($exchange, 'log');
+
+ $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
+
+ $expected = array(
+ array(
+ 'message' => 'test',
+ 'context' => array(
+ 'data' => array(),
+ 'foo' => 34,
+ ),
+ 'level' => 300,
+ 'level_name' => 'WARNING',
+ 'channel' => 'test',
+ 'extra' => array(),
+ ),
+ 'warn.test',
+ 0,
+ array(
+ 'delivery_mode' => 2,
+ 'content_type' => 'application/json',
+ ),
+ );
+
+ $handler->handle($record);
+
+ $this->assertCount(1, $messages);
+ $messages[0][0] = json_decode($messages[0][0], true);
+ unset($messages[0][0]['datetime']);
+ $this->assertEquals($expected, $messages[0]);
+ }
+
+ public function testHandlePhpAmqpLib()
+ {
+ if (!class_exists('PhpAmqpLib\Connection\AMQPConnection')) {
+ $this->markTestSkipped("php-amqplib not installed");
+ }
+
+ $messages = array();
+
+ $exchange = $this->getMock('PhpAmqpLib\Channel\AMQPChannel', array('basic_publish', '__destruct'), array(), '', false);
+
+ $exchange->expects($this->any())
+ ->method('basic_publish')
+ ->will($this->returnCallback(function (AMQPMessage $msg, $exchange = "", $routing_key = "", $mandatory = false, $immediate = false, $ticket = null) use (&$messages) {
+ $messages[] = array($msg, $exchange, $routing_key, $mandatory, $immediate, $ticket);
+ }))
+ ;
+
+ $handler = new AmqpHandler($exchange, 'log');
+
+ $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
+
+ $expected = array(
+ array(
+ 'message' => 'test',
+ 'context' => array(
+ 'data' => array(),
+ 'foo' => 34,
+ ),
+ 'level' => 300,
+ 'level_name' => 'WARNING',
+ 'channel' => 'test',
+ 'extra' => array(),
+ ),
+ 'log',
+ 'warn.test',
+ false,
+ false,
+ null,
+ array(
+ 'delivery_mode' => 2,
+ 'content_type' => 'application/json',
+ ),
+ );
+
+ $handler->handle($record);
+
+ $this->assertCount(1, $messages);
+
+ /* @var $msg AMQPMessage */
+ $msg = $messages[0][0];
+ $messages[0][0] = json_decode($msg->body, true);
+ $messages[0][] = $msg->get_properties();
+ unset($messages[0][0]['datetime']);
+
+ $this->assertEquals($expected, $messages[0]);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php
new file mode 100644
index 0000000..ffb1d74
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/BrowserConsoleHandlerTest.php
@@ -0,0 +1,130 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+/**
+ * @covers Monolog\Handler\BrowserConsoleHandlerTest
+ */
+class BrowserConsoleHandlerTest extends TestCase
+{
+ protected function setUp()
+ {
+ BrowserConsoleHandler::reset();
+ }
+
+ protected function generateScript()
+ {
+ $reflMethod = new \ReflectionMethod('Monolog\Handler\BrowserConsoleHandler', 'generateScript');
+ $reflMethod->setAccessible(true);
+
+ return $reflMethod->invoke(null);
+ }
+
+ public function testStyling()
+ {
+ $handler = new BrowserConsoleHandler();
+ $handler->setFormatter($this->getIdentityFormatter());
+
+ $handler->handle($this->getRecord(Logger::DEBUG, 'foo[[bar]]{color: red}'));
+
+ $expected = <<assertEquals($expected, $this->generateScript());
+ }
+
+ public function testEscaping()
+ {
+ $handler = new BrowserConsoleHandler();
+ $handler->setFormatter($this->getIdentityFormatter());
+
+ $handler->handle($this->getRecord(Logger::DEBUG, "[foo] [[\"bar\n[baz]\"]]{color: red}"));
+
+ $expected = <<assertEquals($expected, $this->generateScript());
+ }
+
+ public function testAutolabel()
+ {
+ $handler = new BrowserConsoleHandler();
+ $handler->setFormatter($this->getIdentityFormatter());
+
+ $handler->handle($this->getRecord(Logger::DEBUG, '[[foo]]{macro: autolabel}'));
+ $handler->handle($this->getRecord(Logger::DEBUG, '[[bar]]{macro: autolabel}'));
+ $handler->handle($this->getRecord(Logger::DEBUG, '[[foo]]{macro: autolabel}'));
+
+ $expected = <<assertEquals($expected, $this->generateScript());
+ }
+
+ public function testContext()
+ {
+ $handler = new BrowserConsoleHandler();
+ $handler->setFormatter($this->getIdentityFormatter());
+
+ $handler->handle($this->getRecord(Logger::DEBUG, 'test', array('foo' => 'bar')));
+
+ $expected = <<assertEquals($expected, $this->generateScript());
+ }
+
+ public function testConcurrentHandlers()
+ {
+ $handler1 = new BrowserConsoleHandler();
+ $handler1->setFormatter($this->getIdentityFormatter());
+
+ $handler2 = new BrowserConsoleHandler();
+ $handler2->setFormatter($this->getIdentityFormatter());
+
+ $handler1->handle($this->getRecord(Logger::DEBUG, 'test1'));
+ $handler2->handle($this->getRecord(Logger::DEBUG, 'test2'));
+ $handler1->handle($this->getRecord(Logger::DEBUG, 'test3'));
+ $handler2->handle($this->getRecord(Logger::DEBUG, 'test4'));
+
+ $expected = <<assertEquals($expected, $this->generateScript());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php
new file mode 100644
index 0000000..da8b3c3
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/BufferHandlerTest.php
@@ -0,0 +1,158 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+class BufferHandlerTest extends TestCase
+{
+ private $shutdownCheckHandler;
+
+ /**
+ * @covers Monolog\Handler\BufferHandler::__construct
+ * @covers Monolog\Handler\BufferHandler::handle
+ * @covers Monolog\Handler\BufferHandler::close
+ */
+ public function testHandleBuffers()
+ {
+ $test = new TestHandler();
+ $handler = new BufferHandler($test);
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+ $this->assertFalse($test->hasDebugRecords());
+ $this->assertFalse($test->hasInfoRecords());
+ $handler->close();
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertTrue(count($test->getRecords()) === 2);
+ }
+
+ /**
+ * @covers Monolog\Handler\BufferHandler::close
+ * @covers Monolog\Handler\BufferHandler::flush
+ */
+ public function testPropagatesRecordsAtEndOfRequest()
+ {
+ $test = new TestHandler();
+ $handler = new BufferHandler($test);
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $this->shutdownCheckHandler = $test;
+ register_shutdown_function(array($this, 'checkPropagation'));
+ }
+
+ public function checkPropagation()
+ {
+ if (!$this->shutdownCheckHandler->hasWarningRecords() || !$this->shutdownCheckHandler->hasDebugRecords()) {
+ echo '!!! BufferHandlerTest::testPropagatesRecordsAtEndOfRequest failed to verify that the messages have been propagated' . PHP_EOL;
+ exit(1);
+ }
+ }
+
+ /**
+ * @covers Monolog\Handler\BufferHandler::handle
+ */
+ public function testHandleBufferLimit()
+ {
+ $test = new TestHandler();
+ $handler = new BufferHandler($test, 2);
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $handler->close();
+ $this->assertTrue($test->hasWarningRecords());
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertFalse($test->hasDebugRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\BufferHandler::handle
+ */
+ public function testHandleBufferLimitWithFlushOnOverflow()
+ {
+ $test = new TestHandler();
+ $handler = new BufferHandler($test, 3, Logger::DEBUG, true, true);
+
+ // send two records
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $this->assertFalse($test->hasDebugRecords());
+ $this->assertCount(0, $test->getRecords());
+
+ // overflow
+ $handler->handle($this->getRecord(Logger::INFO));
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertCount(3, $test->getRecords());
+
+ // should buffer again
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertCount(3, $test->getRecords());
+
+ $handler->close();
+ $this->assertCount(5, $test->getRecords());
+ $this->assertTrue($test->hasWarningRecords());
+ $this->assertTrue($test->hasInfoRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\BufferHandler::handle
+ */
+ public function testHandleLevel()
+ {
+ $test = new TestHandler();
+ $handler = new BufferHandler($test, 0, Logger::INFO);
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->close();
+ $this->assertTrue($test->hasWarningRecords());
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertFalse($test->hasDebugRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\BufferHandler::flush
+ */
+ public function testFlush()
+ {
+ $test = new TestHandler();
+ $handler = new BufferHandler($test, 0);
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+ $handler->flush();
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertFalse($test->hasWarningRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\BufferHandler::handle
+ */
+ public function testHandleUsesProcessors()
+ {
+ $test = new TestHandler();
+ $handler = new BufferHandler($test);
+ $handler->pushProcessor(function ($record) {
+ $record['extra']['foo'] = true;
+
+ return $record;
+ });
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $handler->flush();
+ $this->assertTrue($test->hasWarningRecords());
+ $records = $test->getRecords();
+ $this->assertTrue($records[0]['extra']['foo']);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php
new file mode 100644
index 0000000..0449f8b
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php
@@ -0,0 +1,156 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+/**
+ * @covers Monolog\Handler\ChromePHPHandler
+ */
+class ChromePHPHandlerTest extends TestCase
+{
+ protected function setUp()
+ {
+ TestChromePHPHandler::reset();
+ $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; Chrome/1.0';
+ }
+
+ /**
+ * @dataProvider agentsProvider
+ */
+ public function testHeaders($agent)
+ {
+ $_SERVER['HTTP_USER_AGENT'] = $agent;
+
+ $handler = new TestChromePHPHandler();
+ $handler->setFormatter($this->getIdentityFormatter());
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::WARNING));
+
+ $expected = array(
+ 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
+ 'version' => ChromePHPHandler::VERSION,
+ 'columns' => array('label', 'log', 'backtrace', 'type'),
+ 'rows' => array(
+ 'test',
+ 'test',
+ ),
+ 'request_uri' => '',
+ )))),
+ );
+
+ $this->assertEquals($expected, $handler->getHeaders());
+ }
+
+ public static function agentsProvider()
+ {
+ return array(
+ array('Monolog Test; Chrome/1.0'),
+ array('Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'),
+ array('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/56.0.2924.76 Chrome/56.0.2924.76 Safari/537.36'),
+ array('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome Safari/537.36'),
+ );
+ }
+
+ public function testHeadersOverflow()
+ {
+ $handler = new TestChromePHPHandler();
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 150 * 1024)));
+
+ // overflow chrome headers limit
+ $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 100 * 1024)));
+
+ $expected = array(
+ 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
+ 'version' => ChromePHPHandler::VERSION,
+ 'columns' => array('label', 'log', 'backtrace', 'type'),
+ 'rows' => array(
+ array(
+ 'test',
+ 'test',
+ 'unknown',
+ 'log',
+ ),
+ array(
+ 'test',
+ str_repeat('a', 150 * 1024),
+ 'unknown',
+ 'warn',
+ ),
+ array(
+ 'monolog',
+ 'Incomplete logs, chrome header size limit reached',
+ 'unknown',
+ 'warn',
+ ),
+ ),
+ 'request_uri' => '',
+ )))),
+ );
+
+ $this->assertEquals($expected, $handler->getHeaders());
+ }
+
+ public function testConcurrentHandlers()
+ {
+ $handler = new TestChromePHPHandler();
+ $handler->setFormatter($this->getIdentityFormatter());
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::WARNING));
+
+ $handler2 = new TestChromePHPHandler();
+ $handler2->setFormatter($this->getIdentityFormatter());
+ $handler2->handle($this->getRecord(Logger::DEBUG));
+ $handler2->handle($this->getRecord(Logger::WARNING));
+
+ $expected = array(
+ 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
+ 'version' => ChromePHPHandler::VERSION,
+ 'columns' => array('label', 'log', 'backtrace', 'type'),
+ 'rows' => array(
+ 'test',
+ 'test',
+ 'test',
+ 'test',
+ ),
+ 'request_uri' => '',
+ )))),
+ );
+
+ $this->assertEquals($expected, $handler2->getHeaders());
+ }
+}
+
+class TestChromePHPHandler extends ChromePHPHandler
+{
+ protected $headers = array();
+
+ public static function reset()
+ {
+ self::$initialized = false;
+ self::$overflowed = false;
+ self::$sendHeaders = true;
+ self::$json['rows'] = array();
+ }
+
+ protected function sendHeader($header, $content)
+ {
+ $this->headers[$header] = $content;
+ }
+
+ public function getHeaders()
+ {
+ return $this->headers;
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php
new file mode 100644
index 0000000..9fc4b38
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/CouchDBHandlerTest.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+class CouchDBHandlerTest extends TestCase
+{
+ public function testHandle()
+ {
+ $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
+
+ $handler = new CouchDBHandler();
+
+ try {
+ $handler->handle($record);
+ } catch (\RuntimeException $e) {
+ $this->markTestSkipped('Could not connect to couchdb server on http://localhost:5984');
+ }
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php
new file mode 100644
index 0000000..e2aff86
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php
@@ -0,0 +1,165 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+class DeduplicationHandlerTest extends TestCase
+{
+ /**
+ * @covers Monolog\Handler\DeduplicationHandler::flush
+ */
+ public function testFlushPassthruIfAllRecordsUnderTrigger()
+ {
+ $test = new TestHandler();
+ @unlink(sys_get_temp_dir().'/monolog_dedup.log');
+ $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0);
+
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+
+ $handler->flush();
+
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertFalse($test->hasWarningRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\DeduplicationHandler::flush
+ * @covers Monolog\Handler\DeduplicationHandler::appendRecord
+ */
+ public function testFlushPassthruIfEmptyLog()
+ {
+ $test = new TestHandler();
+ @unlink(sys_get_temp_dir().'/monolog_dedup.log');
+ $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0);
+
+ $handler->handle($this->getRecord(Logger::ERROR, 'Foo:bar'));
+ $handler->handle($this->getRecord(Logger::CRITICAL, "Foo\nbar"));
+
+ $handler->flush();
+
+ $this->assertTrue($test->hasErrorRecords());
+ $this->assertTrue($test->hasCriticalRecords());
+ $this->assertFalse($test->hasWarningRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\DeduplicationHandler::flush
+ * @covers Monolog\Handler\DeduplicationHandler::appendRecord
+ * @covers Monolog\Handler\DeduplicationHandler::isDuplicate
+ * @depends testFlushPassthruIfEmptyLog
+ */
+ public function testFlushSkipsIfLogExists()
+ {
+ $test = new TestHandler();
+ $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0);
+
+ $handler->handle($this->getRecord(Logger::ERROR, 'Foo:bar'));
+ $handler->handle($this->getRecord(Logger::CRITICAL, "Foo\nbar"));
+
+ $handler->flush();
+
+ $this->assertFalse($test->hasErrorRecords());
+ $this->assertFalse($test->hasCriticalRecords());
+ $this->assertFalse($test->hasWarningRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\DeduplicationHandler::flush
+ * @covers Monolog\Handler\DeduplicationHandler::appendRecord
+ * @covers Monolog\Handler\DeduplicationHandler::isDuplicate
+ * @depends testFlushPassthruIfEmptyLog
+ */
+ public function testFlushPassthruIfLogTooOld()
+ {
+ $test = new TestHandler();
+ $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0);
+
+ $record = $this->getRecord(Logger::ERROR);
+ $record['datetime']->modify('+62seconds');
+ $handler->handle($record);
+ $record = $this->getRecord(Logger::CRITICAL);
+ $record['datetime']->modify('+62seconds');
+ $handler->handle($record);
+
+ $handler->flush();
+
+ $this->assertTrue($test->hasErrorRecords());
+ $this->assertTrue($test->hasCriticalRecords());
+ $this->assertFalse($test->hasWarningRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\DeduplicationHandler::flush
+ * @covers Monolog\Handler\DeduplicationHandler::appendRecord
+ * @covers Monolog\Handler\DeduplicationHandler::isDuplicate
+ * @covers Monolog\Handler\DeduplicationHandler::collectLogs
+ */
+ public function testGcOldLogs()
+ {
+ $test = new TestHandler();
+ @unlink(sys_get_temp_dir().'/monolog_dedup.log');
+ $handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0);
+
+ // handle two records from yesterday, and one recent
+ $record = $this->getRecord(Logger::ERROR);
+ $record['datetime']->modify('-1day -10seconds');
+ $handler->handle($record);
+ $record2 = $this->getRecord(Logger::CRITICAL);
+ $record2['datetime']->modify('-1day -10seconds');
+ $handler->handle($record2);
+ $record3 = $this->getRecord(Logger::CRITICAL);
+ $record3['datetime']->modify('-30seconds');
+ $handler->handle($record3);
+
+ // log is written as none of them are duplicate
+ $handler->flush();
+ $this->assertSame(
+ $record['datetime']->getTimestamp() . ":ERROR:test\n" .
+ $record2['datetime']->getTimestamp() . ":CRITICAL:test\n" .
+ $record3['datetime']->getTimestamp() . ":CRITICAL:test\n",
+ file_get_contents(sys_get_temp_dir() . '/monolog_dedup.log')
+ );
+ $this->assertTrue($test->hasErrorRecords());
+ $this->assertTrue($test->hasCriticalRecords());
+ $this->assertFalse($test->hasWarningRecords());
+
+ // clear test handler
+ $test->clear();
+ $this->assertFalse($test->hasErrorRecords());
+ $this->assertFalse($test->hasCriticalRecords());
+
+ // log new records, duplicate log gets GC'd at the end of this flush call
+ $handler->handle($record = $this->getRecord(Logger::ERROR));
+ $handler->handle($record2 = $this->getRecord(Logger::CRITICAL));
+ $handler->flush();
+
+ // log should now contain the new errors and the previous one that was recent enough
+ $this->assertSame(
+ $record3['datetime']->getTimestamp() . ":CRITICAL:test\n" .
+ $record['datetime']->getTimestamp() . ":ERROR:test\n" .
+ $record2['datetime']->getTimestamp() . ":CRITICAL:test\n",
+ file_get_contents(sys_get_temp_dir() . '/monolog_dedup.log')
+ );
+ $this->assertTrue($test->hasErrorRecords());
+ $this->assertTrue($test->hasCriticalRecords());
+ $this->assertFalse($test->hasWarningRecords());
+ }
+
+ public static function tearDownAfterClass()
+ {
+ @unlink(sys_get_temp_dir().'/monolog_dedup.log');
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php
new file mode 100644
index 0000000..d67da90
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/DoctrineCouchDBHandlerTest.php
@@ -0,0 +1,52 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+class DoctrineCouchDBHandlerTest extends TestCase
+{
+ protected function setup()
+ {
+ if (!class_exists('Doctrine\CouchDB\CouchDBClient')) {
+ $this->markTestSkipped('The "doctrine/couchdb" package is not installed');
+ }
+ }
+
+ public function testHandle()
+ {
+ $client = $this->getMockBuilder('Doctrine\\CouchDB\\CouchDBClient')
+ ->setMethods(array('postDocument'))
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
+
+ $expected = array(
+ 'message' => 'test',
+ 'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34),
+ 'level' => Logger::WARNING,
+ 'level_name' => 'WARNING',
+ 'channel' => 'test',
+ 'datetime' => $record['datetime']->format('Y-m-d H:i:s'),
+ 'extra' => array(),
+ );
+
+ $client->expects($this->once())
+ ->method('postDocument')
+ ->with($expected);
+
+ $handler = new DoctrineCouchDBHandler($client);
+ $handler->handle($record);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php
new file mode 100644
index 0000000..2e6c348
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php
@@ -0,0 +1,82 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+
+class DynamoDbHandlerTest extends TestCase
+{
+ private $client;
+
+ public function setUp()
+ {
+ if (!class_exists('Aws\DynamoDb\DynamoDbClient')) {
+ $this->markTestSkipped('aws/aws-sdk-php not installed');
+ }
+
+ $this->client = $this->getMockBuilder('Aws\DynamoDb\DynamoDbClient')
+ ->setMethods(array('formatAttributes', '__call'))
+ ->disableOriginalConstructor()->getMock();
+ }
+
+ public function testConstruct()
+ {
+ $this->assertInstanceOf('Monolog\Handler\DynamoDbHandler', new DynamoDbHandler($this->client, 'foo'));
+ }
+
+ public function testInterface()
+ {
+ $this->assertInstanceOf('Monolog\Handler\HandlerInterface', new DynamoDbHandler($this->client, 'foo'));
+ }
+
+ public function testGetFormatter()
+ {
+ $handler = new DynamoDbHandler($this->client, 'foo');
+ $this->assertInstanceOf('Monolog\Formatter\ScalarFormatter', $handler->getFormatter());
+ }
+
+ public function testHandle()
+ {
+ $record = $this->getRecord();
+ $formatter = $this->getMock('Monolog\Formatter\FormatterInterface');
+ $formatted = array('foo' => 1, 'bar' => 2);
+ $handler = new DynamoDbHandler($this->client, 'foo');
+ $handler->setFormatter($formatter);
+
+ $isV3 = defined('Aws\Sdk::VERSION') && version_compare(\Aws\Sdk::VERSION, '3.0', '>=');
+ if ($isV3) {
+ $expFormatted = array('foo' => array('N' => 1), 'bar' => array('N' => 2));
+ } else {
+ $expFormatted = $formatted;
+ }
+
+ $formatter
+ ->expects($this->once())
+ ->method('format')
+ ->with($record)
+ ->will($this->returnValue($formatted));
+ $this->client
+ ->expects($isV3 ? $this->never() : $this->once())
+ ->method('formatAttributes')
+ ->with($this->isType('array'))
+ ->will($this->returnValue($formatted));
+ $this->client
+ ->expects($this->once())
+ ->method('__call')
+ ->with('putItem', array(array(
+ 'TableName' => 'foo',
+ 'Item' => $expFormatted,
+ )));
+
+ $handler->handle($record);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php
new file mode 100644
index 0000000..1687074
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/ElasticSearchHandlerTest.php
@@ -0,0 +1,239 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\ElasticaFormatter;
+use Monolog\Formatter\NormalizerFormatter;
+use Monolog\TestCase;
+use Monolog\Logger;
+use Elastica\Client;
+use Elastica\Request;
+use Elastica\Response;
+
+class ElasticSearchHandlerTest extends TestCase
+{
+ /**
+ * @var Client mock
+ */
+ protected $client;
+
+ /**
+ * @var array Default handler options
+ */
+ protected $options = array(
+ 'index' => 'my_index',
+ 'type' => 'doc_type',
+ );
+
+ public function setUp()
+ {
+ // Elastica lib required
+ if (!class_exists("Elastica\Client")) {
+ $this->markTestSkipped("ruflin/elastica not installed");
+ }
+
+ // base mock Elastica Client object
+ $this->client = $this->getMockBuilder('Elastica\Client')
+ ->setMethods(array('addDocuments'))
+ ->disableOriginalConstructor()
+ ->getMock();
+ }
+
+ /**
+ * @covers Monolog\Handler\ElasticSearchHandler::write
+ * @covers Monolog\Handler\ElasticSearchHandler::handleBatch
+ * @covers Monolog\Handler\ElasticSearchHandler::bulkSend
+ * @covers Monolog\Handler\ElasticSearchHandler::getDefaultFormatter
+ */
+ public function testHandle()
+ {
+ // log message
+ $msg = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'log',
+ );
+
+ // format expected result
+ $formatter = new ElasticaFormatter($this->options['index'], $this->options['type']);
+ $expected = array($formatter->format($msg));
+
+ // setup ES client mock
+ $this->client->expects($this->any())
+ ->method('addDocuments')
+ ->with($expected);
+
+ // perform tests
+ $handler = new ElasticSearchHandler($this->client, $this->options);
+ $handler->handle($msg);
+ $handler->handleBatch(array($msg));
+ }
+
+ /**
+ * @covers Monolog\Handler\ElasticSearchHandler::setFormatter
+ */
+ public function testSetFormatter()
+ {
+ $handler = new ElasticSearchHandler($this->client);
+ $formatter = new ElasticaFormatter('index_new', 'type_new');
+ $handler->setFormatter($formatter);
+ $this->assertInstanceOf('Monolog\Formatter\ElasticaFormatter', $handler->getFormatter());
+ $this->assertEquals('index_new', $handler->getFormatter()->getIndex());
+ $this->assertEquals('type_new', $handler->getFormatter()->getType());
+ }
+
+ /**
+ * @covers Monolog\Handler\ElasticSearchHandler::setFormatter
+ * @expectedException InvalidArgumentException
+ * @expectedExceptionMessage ElasticSearchHandler is only compatible with ElasticaFormatter
+ */
+ public function testSetFormatterInvalid()
+ {
+ $handler = new ElasticSearchHandler($this->client);
+ $formatter = new NormalizerFormatter();
+ $handler->setFormatter($formatter);
+ }
+
+ /**
+ * @covers Monolog\Handler\ElasticSearchHandler::__construct
+ * @covers Monolog\Handler\ElasticSearchHandler::getOptions
+ */
+ public function testOptions()
+ {
+ $expected = array(
+ 'index' => $this->options['index'],
+ 'type' => $this->options['type'],
+ 'ignore_error' => false,
+ );
+ $handler = new ElasticSearchHandler($this->client, $this->options);
+ $this->assertEquals($expected, $handler->getOptions());
+ }
+
+ /**
+ * @covers Monolog\Handler\ElasticSearchHandler::bulkSend
+ * @dataProvider providerTestConnectionErrors
+ */
+ public function testConnectionErrors($ignore, $expectedError)
+ {
+ $clientOpts = array('host' => '127.0.0.1', 'port' => 1);
+ $client = new Client($clientOpts);
+ $handlerOpts = array('ignore_error' => $ignore);
+ $handler = new ElasticSearchHandler($client, $handlerOpts);
+
+ if ($expectedError) {
+ $this->setExpectedException($expectedError[0], $expectedError[1]);
+ $handler->handle($this->getRecord());
+ } else {
+ $this->assertFalse($handler->handle($this->getRecord()));
+ }
+ }
+
+ /**
+ * @return array
+ */
+ public function providerTestConnectionErrors()
+ {
+ return array(
+ array(false, array('RuntimeException', 'Error sending messages to Elasticsearch')),
+ array(true, false),
+ );
+ }
+
+ /**
+ * Integration test using localhost Elastic Search server
+ *
+ * @covers Monolog\Handler\ElasticSearchHandler::__construct
+ * @covers Monolog\Handler\ElasticSearchHandler::handleBatch
+ * @covers Monolog\Handler\ElasticSearchHandler::bulkSend
+ * @covers Monolog\Handler\ElasticSearchHandler::getDefaultFormatter
+ */
+ public function testHandleIntegration()
+ {
+ $msg = array(
+ 'level' => Logger::ERROR,
+ 'level_name' => 'ERROR',
+ 'channel' => 'meh',
+ 'context' => array('foo' => 7, 'bar', 'class' => new \stdClass),
+ 'datetime' => new \DateTime("@0"),
+ 'extra' => array(),
+ 'message' => 'log',
+ );
+
+ $expected = $msg;
+ $expected['datetime'] = $msg['datetime']->format(\DateTime::ISO8601);
+ $expected['context'] = array(
+ 'class' => '[object] (stdClass: {})',
+ 'foo' => 7,
+ 0 => 'bar',
+ );
+
+ $client = new Client();
+ $handler = new ElasticSearchHandler($client, $this->options);
+ try {
+ $handler->handleBatch(array($msg));
+ } catch (\RuntimeException $e) {
+ $this->markTestSkipped("Cannot connect to Elastic Search server on localhost");
+ }
+
+ // check document id from ES server response
+ $documentId = $this->getCreatedDocId($client->getLastResponse());
+ $this->assertNotEmpty($documentId, 'No elastic document id received');
+
+ // retrieve document source from ES and validate
+ $document = $this->getDocSourceFromElastic(
+ $client,
+ $this->options['index'],
+ $this->options['type'],
+ $documentId
+ );
+ $this->assertEquals($expected, $document);
+
+ // remove test index from ES
+ $client->request("/{$this->options['index']}", Request::DELETE);
+ }
+
+ /**
+ * Return last created document id from ES response
+ * @param Response $response Elastica Response object
+ * @return string|null
+ */
+ protected function getCreatedDocId(Response $response)
+ {
+ $data = $response->getData();
+ if (!empty($data['items'][0]['create']['_id'])) {
+ return $data['items'][0]['create']['_id'];
+ }
+ }
+
+ /**
+ * Retrieve document by id from Elasticsearch
+ * @param Client $client Elastica client
+ * @param string $index
+ * @param string $type
+ * @param string $documentId
+ * @return array
+ */
+ protected function getDocSourceFromElastic(Client $client, $index, $type, $documentId)
+ {
+ $resp = $client->request("/{$index}/{$type}/{$documentId}", Request::GET);
+ $data = $resp->getData();
+ if (!empty($data['_source'])) {
+ return $data['_source'];
+ }
+
+ return array();
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php
new file mode 100644
index 0000000..99785cb
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/ErrorLogHandlerTest.php
@@ -0,0 +1,66 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+use Monolog\Formatter\LineFormatter;
+
+function error_log()
+{
+ $GLOBALS['error_log'][] = func_get_args();
+}
+
+class ErrorLogHandlerTest extends TestCase
+{
+ protected function setUp()
+ {
+ $GLOBALS['error_log'] = array();
+ }
+
+ /**
+ * @covers Monolog\Handler\ErrorLogHandler::__construct
+ * @expectedException InvalidArgumentException
+ * @expectedExceptionMessage The given message type "42" is not supported
+ */
+ public function testShouldNotAcceptAnInvalidTypeOnContructor()
+ {
+ new ErrorLogHandler(42);
+ }
+
+ /**
+ * @covers Monolog\Handler\ErrorLogHandler::write
+ */
+ public function testShouldLogMessagesUsingErrorLogFuncion()
+ {
+ $type = ErrorLogHandler::OPERATING_SYSTEM;
+ $handler = new ErrorLogHandler($type);
+ $handler->setFormatter(new LineFormatter('%channel%.%level_name%: %message% %context% %extra%', null, true));
+ $handler->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz"));
+
+ $this->assertSame("test.ERROR: Foo\nBar\r\n\r\nBaz [] []", $GLOBALS['error_log'][0][0]);
+ $this->assertSame($GLOBALS['error_log'][0][1], $type);
+
+ $handler = new ErrorLogHandler($type, Logger::DEBUG, true, true);
+ $handler->setFormatter(new LineFormatter(null, null, true));
+ $handler->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz"));
+
+ $this->assertStringMatchesFormat('[%s] test.ERROR: Foo', $GLOBALS['error_log'][1][0]);
+ $this->assertSame($GLOBALS['error_log'][1][1], $type);
+
+ $this->assertStringMatchesFormat('Bar', $GLOBALS['error_log'][2][0]);
+ $this->assertSame($GLOBALS['error_log'][2][1], $type);
+
+ $this->assertStringMatchesFormat('Baz [] []', $GLOBALS['error_log'][3][0]);
+ $this->assertSame($GLOBALS['error_log'][3][1], $type);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php
new file mode 100644
index 0000000..31b7686
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/FilterHandlerTest.php
@@ -0,0 +1,170 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\TestCase;
+
+class FilterHandlerTest extends TestCase
+{
+ /**
+ * @covers Monolog\Handler\FilterHandler::isHandling
+ */
+ public function testIsHandling()
+ {
+ $test = new TestHandler();
+ $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE);
+ $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG)));
+ $this->assertTrue($handler->isHandling($this->getRecord(Logger::INFO)));
+ $this->assertTrue($handler->isHandling($this->getRecord(Logger::NOTICE)));
+ $this->assertFalse($handler->isHandling($this->getRecord(Logger::WARNING)));
+ $this->assertFalse($handler->isHandling($this->getRecord(Logger::ERROR)));
+ $this->assertFalse($handler->isHandling($this->getRecord(Logger::CRITICAL)));
+ $this->assertFalse($handler->isHandling($this->getRecord(Logger::ALERT)));
+ $this->assertFalse($handler->isHandling($this->getRecord(Logger::EMERGENCY)));
+ }
+
+ /**
+ * @covers Monolog\Handler\FilterHandler::handle
+ * @covers Monolog\Handler\FilterHandler::setAcceptedLevels
+ * @covers Monolog\Handler\FilterHandler::isHandling
+ */
+ public function testHandleProcessOnlyNeededLevels()
+ {
+ $test = new TestHandler();
+ $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE);
+
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $this->assertFalse($test->hasDebugRecords());
+
+ $handler->handle($this->getRecord(Logger::INFO));
+ $this->assertTrue($test->hasInfoRecords());
+ $handler->handle($this->getRecord(Logger::NOTICE));
+ $this->assertTrue($test->hasNoticeRecords());
+
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertFalse($test->hasWarningRecords());
+ $handler->handle($this->getRecord(Logger::ERROR));
+ $this->assertFalse($test->hasErrorRecords());
+ $handler->handle($this->getRecord(Logger::CRITICAL));
+ $this->assertFalse($test->hasCriticalRecords());
+ $handler->handle($this->getRecord(Logger::ALERT));
+ $this->assertFalse($test->hasAlertRecords());
+ $handler->handle($this->getRecord(Logger::EMERGENCY));
+ $this->assertFalse($test->hasEmergencyRecords());
+
+ $test = new TestHandler();
+ $handler = new FilterHandler($test, array(Logger::INFO, Logger::ERROR));
+
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $this->assertFalse($test->hasDebugRecords());
+ $handler->handle($this->getRecord(Logger::INFO));
+ $this->assertTrue($test->hasInfoRecords());
+ $handler->handle($this->getRecord(Logger::NOTICE));
+ $this->assertFalse($test->hasNoticeRecords());
+ $handler->handle($this->getRecord(Logger::ERROR));
+ $this->assertTrue($test->hasErrorRecords());
+ $handler->handle($this->getRecord(Logger::CRITICAL));
+ $this->assertFalse($test->hasCriticalRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\FilterHandler::setAcceptedLevels
+ * @covers Monolog\Handler\FilterHandler::getAcceptedLevels
+ */
+ public function testAcceptedLevelApi()
+ {
+ $test = new TestHandler();
+ $handler = new FilterHandler($test);
+
+ $levels = array(Logger::INFO, Logger::ERROR);
+ $handler->setAcceptedLevels($levels);
+ $this->assertSame($levels, $handler->getAcceptedLevels());
+
+ $handler->setAcceptedLevels(array('info', 'error'));
+ $this->assertSame($levels, $handler->getAcceptedLevels());
+
+ $levels = array(Logger::CRITICAL, Logger::ALERT, Logger::EMERGENCY);
+ $handler->setAcceptedLevels(Logger::CRITICAL, Logger::EMERGENCY);
+ $this->assertSame($levels, $handler->getAcceptedLevels());
+
+ $handler->setAcceptedLevels('critical', 'emergency');
+ $this->assertSame($levels, $handler->getAcceptedLevels());
+ }
+
+ /**
+ * @covers Monolog\Handler\FilterHandler::handle
+ */
+ public function testHandleUsesProcessors()
+ {
+ $test = new TestHandler();
+ $handler = new FilterHandler($test, Logger::DEBUG, Logger::EMERGENCY);
+ $handler->pushProcessor(
+ function ($record) {
+ $record['extra']['foo'] = true;
+
+ return $record;
+ }
+ );
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertTrue($test->hasWarningRecords());
+ $records = $test->getRecords();
+ $this->assertTrue($records[0]['extra']['foo']);
+ }
+
+ /**
+ * @covers Monolog\Handler\FilterHandler::handle
+ */
+ public function testHandleRespectsBubble()
+ {
+ $test = new TestHandler();
+
+ $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE, false);
+ $this->assertTrue($handler->handle($this->getRecord(Logger::INFO)));
+ $this->assertFalse($handler->handle($this->getRecord(Logger::WARNING)));
+
+ $handler = new FilterHandler($test, Logger::INFO, Logger::NOTICE, true);
+ $this->assertFalse($handler->handle($this->getRecord(Logger::INFO)));
+ $this->assertFalse($handler->handle($this->getRecord(Logger::WARNING)));
+ }
+
+ /**
+ * @covers Monolog\Handler\FilterHandler::handle
+ */
+ public function testHandleWithCallback()
+ {
+ $test = new TestHandler();
+ $handler = new FilterHandler(
+ function ($record, $handler) use ($test) {
+ return $test;
+ }, Logger::INFO, Logger::NOTICE, false
+ );
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+ $this->assertFalse($test->hasDebugRecords());
+ $this->assertTrue($test->hasInfoRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\FilterHandler::handle
+ * @expectedException \RuntimeException
+ */
+ public function testHandleWithBadCallbackThrowsException()
+ {
+ $handler = new FilterHandler(
+ function ($record, $handler) {
+ return 'foo';
+ }
+ );
+ $handler->handle($this->getRecord(Logger::WARNING));
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php
new file mode 100644
index 0000000..b92bf43
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php
@@ -0,0 +1,279 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
+use Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy;
+use Psr\Log\LogLevel;
+
+class FingersCrossedHandlerTest extends TestCase
+{
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::__construct
+ * @covers Monolog\Handler\FingersCrossedHandler::handle
+ * @covers Monolog\Handler\FingersCrossedHandler::activate
+ */
+ public function testHandleBuffers()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test);
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+ $this->assertFalse($test->hasDebugRecords());
+ $this->assertFalse($test->hasInfoRecords());
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $handler->close();
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertTrue(count($test->getRecords()) === 3);
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::handle
+ * @covers Monolog\Handler\FingersCrossedHandler::activate
+ */
+ public function testHandleStopsBufferingAfterTrigger()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test);
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->close();
+ $this->assertTrue($test->hasWarningRecords());
+ $this->assertTrue($test->hasDebugRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::handle
+ * @covers Monolog\Handler\FingersCrossedHandler::activate
+ * @covers Monolog\Handler\FingersCrossedHandler::reset
+ */
+ public function testHandleRestartBufferingAfterReset()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test);
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->reset();
+ $handler->handle($this->getRecord(Logger::INFO));
+ $handler->close();
+ $this->assertTrue($test->hasWarningRecords());
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertFalse($test->hasInfoRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::handle
+ * @covers Monolog\Handler\FingersCrossedHandler::activate
+ */
+ public function testHandleRestartBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test, Logger::WARNING, 0, false, false);
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $handler->handle($this->getRecord(Logger::INFO));
+ $handler->close();
+ $this->assertTrue($test->hasWarningRecords());
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertFalse($test->hasInfoRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::handle
+ * @covers Monolog\Handler\FingersCrossedHandler::activate
+ */
+ public function testHandleBufferLimit()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test, Logger::WARNING, 2);
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertTrue($test->hasWarningRecords());
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertFalse($test->hasDebugRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::handle
+ * @covers Monolog\Handler\FingersCrossedHandler::activate
+ */
+ public function testHandleWithCallback()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler(function ($record, $handler) use ($test) {
+ return $test;
+ });
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+ $this->assertFalse($test->hasDebugRecords());
+ $this->assertFalse($test->hasInfoRecords());
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertTrue(count($test->getRecords()) === 3);
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::handle
+ * @covers Monolog\Handler\FingersCrossedHandler::activate
+ * @expectedException RuntimeException
+ */
+ public function testHandleWithBadCallbackThrowsException()
+ {
+ $handler = new FingersCrossedHandler(function ($record, $handler) {
+ return 'foo';
+ });
+ $handler->handle($this->getRecord(Logger::WARNING));
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::isHandling
+ */
+ public function testIsHandlingAlways()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test, Logger::ERROR);
+ $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG)));
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::__construct
+ * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::__construct
+ * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::isHandlerActivated
+ */
+ public function testErrorLevelActivationStrategy()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING));
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $this->assertFalse($test->hasDebugRecords());
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertTrue($test->hasWarningRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::__construct
+ * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::__construct
+ * @covers Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy::isHandlerActivated
+ */
+ public function testErrorLevelActivationStrategyWithPsrLevel()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning'));
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $this->assertFalse($test->hasDebugRecords());
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertTrue($test->hasWarningRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::__construct
+ * @covers Monolog\Handler\FingersCrossedHandler::activate
+ */
+ public function testOverrideActivationStrategy()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning'));
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $this->assertFalse($test->hasDebugRecords());
+ $handler->activate();
+ $this->assertTrue($test->hasDebugRecords());
+ $handler->handle($this->getRecord(Logger::INFO));
+ $this->assertTrue($test->hasInfoRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct
+ * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated
+ */
+ public function testChannelLevelActivationStrategy()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy(Logger::ERROR, array('othertest' => Logger::DEBUG)));
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertFalse($test->hasWarningRecords());
+ $record = $this->getRecord(Logger::DEBUG);
+ $record['channel'] = 'othertest';
+ $handler->handle($record);
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertTrue($test->hasWarningRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct
+ * @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated
+ */
+ public function testChannelLevelActivationStrategyWithPsrLevels()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy('error', array('othertest' => 'debug')));
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertFalse($test->hasWarningRecords());
+ $record = $this->getRecord(Logger::DEBUG);
+ $record['channel'] = 'othertest';
+ $handler->handle($record);
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertTrue($test->hasWarningRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::handle
+ * @covers Monolog\Handler\FingersCrossedHandler::activate
+ */
+ public function testHandleUsesProcessors()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test, Logger::INFO);
+ $handler->pushProcessor(function ($record) {
+ $record['extra']['foo'] = true;
+
+ return $record;
+ });
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertTrue($test->hasWarningRecords());
+ $records = $test->getRecords();
+ $this->assertTrue($records[0]['extra']['foo']);
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::close
+ */
+ public function testPassthruOnClose()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, Logger::INFO);
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+ $handler->close();
+ $this->assertFalse($test->hasDebugRecords());
+ $this->assertTrue($test->hasInfoRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\FingersCrossedHandler::close
+ */
+ public function testPsrLevelPassthruOnClose()
+ {
+ $test = new TestHandler();
+ $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, LogLevel::INFO);
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+ $handler->close();
+ $this->assertFalse($test->hasDebugRecords());
+ $this->assertTrue($test->hasInfoRecords());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php
new file mode 100644
index 0000000..0eb10a6
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php
@@ -0,0 +1,96 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+/**
+ * @covers Monolog\Handler\FirePHPHandler
+ */
+class FirePHPHandlerTest extends TestCase
+{
+ public function setUp()
+ {
+ TestFirePHPHandler::reset();
+ $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; FirePHP/1.0';
+ }
+
+ public function testHeaders()
+ {
+ $handler = new TestFirePHPHandler;
+ $handler->setFormatter($this->getIdentityFormatter());
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::WARNING));
+
+ $expected = array(
+ 'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2',
+ 'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1',
+ 'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3',
+ 'X-Wf-1-1-1-1' => 'test',
+ 'X-Wf-1-1-1-2' => 'test',
+ );
+
+ $this->assertEquals($expected, $handler->getHeaders());
+ }
+
+ public function testConcurrentHandlers()
+ {
+ $handler = new TestFirePHPHandler;
+ $handler->setFormatter($this->getIdentityFormatter());
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::WARNING));
+
+ $handler2 = new TestFirePHPHandler;
+ $handler2->setFormatter($this->getIdentityFormatter());
+ $handler2->handle($this->getRecord(Logger::DEBUG));
+ $handler2->handle($this->getRecord(Logger::WARNING));
+
+ $expected = array(
+ 'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2',
+ 'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1',
+ 'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3',
+ 'X-Wf-1-1-1-1' => 'test',
+ 'X-Wf-1-1-1-2' => 'test',
+ );
+
+ $expected2 = array(
+ 'X-Wf-1-1-1-3' => 'test',
+ 'X-Wf-1-1-1-4' => 'test',
+ );
+
+ $this->assertEquals($expected, $handler->getHeaders());
+ $this->assertEquals($expected2, $handler2->getHeaders());
+ }
+}
+
+class TestFirePHPHandler extends FirePHPHandler
+{
+ protected $headers = array();
+
+ public static function reset()
+ {
+ self::$initialized = false;
+ self::$sendHeaders = true;
+ self::$messageIndex = 1;
+ }
+
+ protected function sendHeader($header, $content)
+ {
+ $this->headers[$header] = $content;
+ }
+
+ public function getHeaders()
+ {
+ return $this->headers;
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/Fixtures/.gitkeep b/vendor/monolog/monolog/tests/Monolog/Handler/Fixtures/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php
new file mode 100644
index 0000000..91cdd31
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/FleepHookHandlerTest.php
@@ -0,0 +1,85 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\LineFormatter;
+use Monolog\Logger;
+use Monolog\TestCase;
+
+/**
+ * @coversDefaultClass \Monolog\Handler\FleepHookHandler
+ */
+class FleepHookHandlerTest extends TestCase
+{
+ /**
+ * Default token to use in tests
+ */
+ const TOKEN = '123abc';
+
+ /**
+ * @var FleepHookHandler
+ */
+ private $handler;
+
+ public function setUp()
+ {
+ parent::setUp();
+
+ if (!extension_loaded('openssl')) {
+ $this->markTestSkipped('This test requires openssl extension to run');
+ }
+
+ // Create instances of the handler and logger for convenience
+ $this->handler = new FleepHookHandler(self::TOKEN);
+ }
+
+ /**
+ * @covers ::__construct
+ */
+ public function testConstructorSetsExpectedDefaults()
+ {
+ $this->assertEquals(Logger::DEBUG, $this->handler->getLevel());
+ $this->assertEquals(true, $this->handler->getBubble());
+ }
+
+ /**
+ * @covers ::getDefaultFormatter
+ */
+ public function testHandlerUsesLineFormatterWhichIgnoresEmptyArrays()
+ {
+ $record = array(
+ 'message' => 'msg',
+ 'context' => array(),
+ 'level' => Logger::DEBUG,
+ 'level_name' => Logger::getLevelName(Logger::DEBUG),
+ 'channel' => 'channel',
+ 'datetime' => new \DateTime(),
+ 'extra' => array(),
+ );
+
+ $expectedFormatter = new LineFormatter(null, null, true, true);
+ $expected = $expectedFormatter->format($record);
+
+ $handlerFormatter = $this->handler->getFormatter();
+ $actual = $handlerFormatter->format($record);
+
+ $this->assertEquals($expected, $actual, 'Empty context and extra arrays should not be rendered');
+ }
+
+ /**
+ * @covers ::__construct
+ */
+ public function testConnectionStringisConstructedCorrectly()
+ {
+ $this->assertEquals('ssl://' . FleepHookHandler::FLEEP_HOST . ':443', $this->handler->getConnectionString());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php
new file mode 100644
index 0000000..4b120d5
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/FlowdockHandlerTest.php
@@ -0,0 +1,88 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\FlowdockFormatter;
+use Monolog\TestCase;
+use Monolog\Logger;
+
+/**
+ * @author Dominik Liebler
+ * @see https://www.hipchat.com/docs/api
+ */
+class FlowdockHandlerTest extends TestCase
+{
+ /**
+ * @var resource
+ */
+ private $res;
+
+ /**
+ * @var FlowdockHandler
+ */
+ private $handler;
+
+ public function setUp()
+ {
+ if (!extension_loaded('openssl')) {
+ $this->markTestSkipped('This test requires openssl to run');
+ }
+ }
+
+ public function testWriteHeader()
+ {
+ $this->createHandler();
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/POST \/v1\/messages\/team_inbox\/.* HTTP\/1.1\\r\\nHost: api.flowdock.com\\r\\nContent-Type: application\/json\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
+
+ return $content;
+ }
+
+ /**
+ * @depends testWriteHeader
+ */
+ public function testWriteContent($content)
+ {
+ $this->assertRegexp('/"source":"test_source"/', $content);
+ $this->assertRegexp('/"from_address":"source@test\.com"/', $content);
+ }
+
+ private function createHandler($token = 'myToken')
+ {
+ $constructorArgs = array($token, Logger::DEBUG);
+ $this->res = fopen('php://memory', 'a');
+ $this->handler = $this->getMock(
+ '\Monolog\Handler\FlowdockHandler',
+ array('fsockopen', 'streamSetTimeout', 'closeSocket'),
+ $constructorArgs
+ );
+
+ $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+ $reflectionProperty->setAccessible(true);
+ $reflectionProperty->setValue($this->handler, 'localhost:1234');
+
+ $this->handler->expects($this->any())
+ ->method('fsockopen')
+ ->will($this->returnValue($this->res));
+ $this->handler->expects($this->any())
+ ->method('streamSetTimeout')
+ ->will($this->returnValue(true));
+ $this->handler->expects($this->any())
+ ->method('closeSocket')
+ ->will($this->returnValue(true));
+
+ $this->handler->setFormatter(new FlowdockFormatter('test_source', 'source@test.com'));
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php
new file mode 100644
index 0000000..9d007b1
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerLegacyTest.php
@@ -0,0 +1,95 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Gelf\Message;
+use Monolog\TestCase;
+use Monolog\Logger;
+use Monolog\Formatter\GelfMessageFormatter;
+
+class GelfHandlerLegacyTest extends TestCase
+{
+ public function setUp()
+ {
+ if (!class_exists('Gelf\MessagePublisher') || !class_exists('Gelf\Message')) {
+ $this->markTestSkipped("mlehner/gelf-php not installed");
+ }
+
+ require_once __DIR__ . '/GelfMockMessagePublisher.php';
+ }
+
+ /**
+ * @covers Monolog\Handler\GelfHandler::__construct
+ */
+ public function testConstruct()
+ {
+ $handler = new GelfHandler($this->getMessagePublisher());
+ $this->assertInstanceOf('Monolog\Handler\GelfHandler', $handler);
+ }
+
+ protected function getHandler($messagePublisher)
+ {
+ $handler = new GelfHandler($messagePublisher);
+
+ return $handler;
+ }
+
+ protected function getMessagePublisher()
+ {
+ return new GelfMockMessagePublisher('localhost');
+ }
+
+ public function testDebug()
+ {
+ $messagePublisher = $this->getMessagePublisher();
+ $handler = $this->getHandler($messagePublisher);
+
+ $record = $this->getRecord(Logger::DEBUG, "A test debug message");
+ $handler->handle($record);
+
+ $this->assertEquals(7, $messagePublisher->lastMessage->getLevel());
+ $this->assertEquals('test', $messagePublisher->lastMessage->getFacility());
+ $this->assertEquals($record['message'], $messagePublisher->lastMessage->getShortMessage());
+ $this->assertEquals(null, $messagePublisher->lastMessage->getFullMessage());
+ }
+
+ public function testWarning()
+ {
+ $messagePublisher = $this->getMessagePublisher();
+ $handler = $this->getHandler($messagePublisher);
+
+ $record = $this->getRecord(Logger::WARNING, "A test warning message");
+ $handler->handle($record);
+
+ $this->assertEquals(4, $messagePublisher->lastMessage->getLevel());
+ $this->assertEquals('test', $messagePublisher->lastMessage->getFacility());
+ $this->assertEquals($record['message'], $messagePublisher->lastMessage->getShortMessage());
+ $this->assertEquals(null, $messagePublisher->lastMessage->getFullMessage());
+ }
+
+ public function testInjectedGelfMessageFormatter()
+ {
+ $messagePublisher = $this->getMessagePublisher();
+ $handler = $this->getHandler($messagePublisher);
+
+ $handler->setFormatter(new GelfMessageFormatter('mysystem', 'EXT', 'CTX'));
+
+ $record = $this->getRecord(Logger::WARNING, "A test warning message");
+ $record['extra']['blarg'] = 'yep';
+ $record['context']['from'] = 'logger';
+ $handler->handle($record);
+
+ $this->assertEquals('mysystem', $messagePublisher->lastMessage->getHost());
+ $this->assertArrayHasKey('_EXTblarg', $messagePublisher->lastMessage->toArray());
+ $this->assertArrayHasKey('_CTXfrom', $messagePublisher->lastMessage->toArray());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php
new file mode 100644
index 0000000..8cdd64f
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/GelfHandlerTest.php
@@ -0,0 +1,117 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Gelf\Message;
+use Monolog\TestCase;
+use Monolog\Logger;
+use Monolog\Formatter\GelfMessageFormatter;
+
+class GelfHandlerTest extends TestCase
+{
+ public function setUp()
+ {
+ if (!class_exists('Gelf\Publisher') || !class_exists('Gelf\Message')) {
+ $this->markTestSkipped("graylog2/gelf-php not installed");
+ }
+ }
+
+ /**
+ * @covers Monolog\Handler\GelfHandler::__construct
+ */
+ public function testConstruct()
+ {
+ $handler = new GelfHandler($this->getMessagePublisher());
+ $this->assertInstanceOf('Monolog\Handler\GelfHandler', $handler);
+ }
+
+ protected function getHandler($messagePublisher)
+ {
+ $handler = new GelfHandler($messagePublisher);
+
+ return $handler;
+ }
+
+ protected function getMessagePublisher()
+ {
+ return $this->getMock('Gelf\Publisher', array('publish'), array(), '', false);
+ }
+
+ public function testDebug()
+ {
+ $record = $this->getRecord(Logger::DEBUG, "A test debug message");
+ $expectedMessage = new Message();
+ $expectedMessage
+ ->setLevel(7)
+ ->setFacility("test")
+ ->setShortMessage($record['message'])
+ ->setTimestamp($record['datetime'])
+ ;
+
+ $messagePublisher = $this->getMessagePublisher();
+ $messagePublisher->expects($this->once())
+ ->method('publish')
+ ->with($expectedMessage);
+
+ $handler = $this->getHandler($messagePublisher);
+
+ $handler->handle($record);
+ }
+
+ public function testWarning()
+ {
+ $record = $this->getRecord(Logger::WARNING, "A test warning message");
+ $expectedMessage = new Message();
+ $expectedMessage
+ ->setLevel(4)
+ ->setFacility("test")
+ ->setShortMessage($record['message'])
+ ->setTimestamp($record['datetime'])
+ ;
+
+ $messagePublisher = $this->getMessagePublisher();
+ $messagePublisher->expects($this->once())
+ ->method('publish')
+ ->with($expectedMessage);
+
+ $handler = $this->getHandler($messagePublisher);
+
+ $handler->handle($record);
+ }
+
+ public function testInjectedGelfMessageFormatter()
+ {
+ $record = $this->getRecord(Logger::WARNING, "A test warning message");
+ $record['extra']['blarg'] = 'yep';
+ $record['context']['from'] = 'logger';
+
+ $expectedMessage = new Message();
+ $expectedMessage
+ ->setLevel(4)
+ ->setFacility("test")
+ ->setHost("mysystem")
+ ->setShortMessage($record['message'])
+ ->setTimestamp($record['datetime'])
+ ->setAdditional("EXTblarg", 'yep')
+ ->setAdditional("CTXfrom", 'logger')
+ ;
+
+ $messagePublisher = $this->getMessagePublisher();
+ $messagePublisher->expects($this->once())
+ ->method('publish')
+ ->with($expectedMessage);
+
+ $handler = $this->getHandler($messagePublisher);
+ $handler->setFormatter(new GelfMessageFormatter('mysystem', 'EXT', 'CTX'));
+ $handler->handle($record);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php b/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php
new file mode 100644
index 0000000..873d92f
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/GelfMockMessagePublisher.php
@@ -0,0 +1,25 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Gelf\MessagePublisher;
+use Gelf\Message;
+
+class GelfMockMessagePublisher extends MessagePublisher
+{
+ public function publish(Message $message)
+ {
+ $this->lastMessage = $message;
+ }
+
+ public $lastMessage = null;
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php
new file mode 100644
index 0000000..a1b8617
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php
@@ -0,0 +1,112 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+class GroupHandlerTest extends TestCase
+{
+ /**
+ * @covers Monolog\Handler\GroupHandler::__construct
+ * @expectedException InvalidArgumentException
+ */
+ public function testConstructorOnlyTakesHandler()
+ {
+ new GroupHandler(array(new TestHandler(), "foo"));
+ }
+
+ /**
+ * @covers Monolog\Handler\GroupHandler::__construct
+ * @covers Monolog\Handler\GroupHandler::handle
+ */
+ public function testHandle()
+ {
+ $testHandlers = array(new TestHandler(), new TestHandler());
+ $handler = new GroupHandler($testHandlers);
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+ foreach ($testHandlers as $test) {
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertTrue(count($test->getRecords()) === 2);
+ }
+ }
+
+ /**
+ * @covers Monolog\Handler\GroupHandler::handleBatch
+ */
+ public function testHandleBatch()
+ {
+ $testHandlers = array(new TestHandler(), new TestHandler());
+ $handler = new GroupHandler($testHandlers);
+ $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO)));
+ foreach ($testHandlers as $test) {
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertTrue(count($test->getRecords()) === 2);
+ }
+ }
+
+ /**
+ * @covers Monolog\Handler\GroupHandler::isHandling
+ */
+ public function testIsHandling()
+ {
+ $testHandlers = array(new TestHandler(Logger::ERROR), new TestHandler(Logger::WARNING));
+ $handler = new GroupHandler($testHandlers);
+ $this->assertTrue($handler->isHandling($this->getRecord(Logger::ERROR)));
+ $this->assertTrue($handler->isHandling($this->getRecord(Logger::WARNING)));
+ $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG)));
+ }
+
+ /**
+ * @covers Monolog\Handler\GroupHandler::handle
+ */
+ public function testHandleUsesProcessors()
+ {
+ $test = new TestHandler();
+ $handler = new GroupHandler(array($test));
+ $handler->pushProcessor(function ($record) {
+ $record['extra']['foo'] = true;
+
+ return $record;
+ });
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertTrue($test->hasWarningRecords());
+ $records = $test->getRecords();
+ $this->assertTrue($records[0]['extra']['foo']);
+ }
+
+ /**
+ * @covers Monolog\Handler\GroupHandler::handle
+ */
+ public function testHandleBatchUsesProcessors()
+ {
+ $testHandlers = array(new TestHandler(), new TestHandler());
+ $handler = new GroupHandler($testHandlers);
+ $handler->pushProcessor(function ($record) {
+ $record['extra']['foo'] = true;
+
+ return $record;
+ });
+ $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO)));
+ foreach ($testHandlers as $test) {
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertTrue(count($test->getRecords()) === 2);
+ $records = $test->getRecords();
+ $this->assertTrue($records[0]['extra']['foo']);
+ $this->assertTrue($records[1]['extra']['foo']);
+ }
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php
new file mode 100644
index 0000000..d8d0452
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php
@@ -0,0 +1,130 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+
+/**
+ * @author Alexey Karapetov
+ */
+class HandlerWrapperTest extends TestCase
+{
+ /**
+ * @var HandlerWrapper
+ */
+ private $wrapper;
+
+ private $handler;
+
+ public function setUp()
+ {
+ parent::setUp();
+ $this->handler = $this->getMock('Monolog\\Handler\\HandlerInterface');
+ $this->wrapper = new HandlerWrapper($this->handler);
+ }
+
+ /**
+ * @return array
+ */
+ public function trueFalseDataProvider()
+ {
+ return array(
+ array(true),
+ array(false),
+ );
+ }
+
+ /**
+ * @param $result
+ * @dataProvider trueFalseDataProvider
+ */
+ public function testIsHandling($result)
+ {
+ $record = $this->getRecord();
+ $this->handler->expects($this->once())
+ ->method('isHandling')
+ ->with($record)
+ ->willReturn($result);
+
+ $this->assertEquals($result, $this->wrapper->isHandling($record));
+ }
+
+ /**
+ * @param $result
+ * @dataProvider trueFalseDataProvider
+ */
+ public function testHandle($result)
+ {
+ $record = $this->getRecord();
+ $this->handler->expects($this->once())
+ ->method('handle')
+ ->with($record)
+ ->willReturn($result);
+
+ $this->assertEquals($result, $this->wrapper->handle($record));
+ }
+
+ /**
+ * @param $result
+ * @dataProvider trueFalseDataProvider
+ */
+ public function testHandleBatch($result)
+ {
+ $records = $this->getMultipleRecords();
+ $this->handler->expects($this->once())
+ ->method('handleBatch')
+ ->with($records)
+ ->willReturn($result);
+
+ $this->assertEquals($result, $this->wrapper->handleBatch($records));
+ }
+
+ public function testPushProcessor()
+ {
+ $processor = function () {};
+ $this->handler->expects($this->once())
+ ->method('pushProcessor')
+ ->with($processor);
+
+ $this->assertEquals($this->wrapper, $this->wrapper->pushProcessor($processor));
+ }
+
+ public function testPopProcessor()
+ {
+ $processor = function () {};
+ $this->handler->expects($this->once())
+ ->method('popProcessor')
+ ->willReturn($processor);
+
+ $this->assertEquals($processor, $this->wrapper->popProcessor());
+ }
+
+ public function testSetFormatter()
+ {
+ $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
+ $this->handler->expects($this->once())
+ ->method('setFormatter')
+ ->with($formatter);
+
+ $this->assertEquals($this->wrapper, $this->wrapper->setFormatter($formatter));
+ }
+
+ public function testGetFormatter()
+ {
+ $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
+ $this->handler->expects($this->once())
+ ->method('getFormatter')
+ ->willReturn($formatter);
+
+ $this->assertEquals($formatter, $this->wrapper->getFormatter());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php
new file mode 100644
index 0000000..52dc9da
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php
@@ -0,0 +1,279 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+/**
+ * @author Rafael Dohms
+ * @see https://www.hipchat.com/docs/api
+ */
+class HipChatHandlerTest extends TestCase
+{
+ private $res;
+ /** @var HipChatHandler */
+ private $handler;
+
+ public function testWriteHeader()
+ {
+ $this->createHandler();
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: api.hipchat.com\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
+
+ return $content;
+ }
+
+ public function testWriteCustomHostHeader()
+ {
+ $this->createHandler('myToken', 'room1', 'Monolog', true, 'hipchat.foo.bar');
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/POST \/v1\/rooms\/message\?format=json&auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
+
+ return $content;
+ }
+
+ public function testWriteV2()
+ {
+ $this->createHandler('myToken', 'room1', 'Monolog', false, 'hipchat.foo.bar', 'v2');
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/POST \/v2\/room\/room1\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
+
+ return $content;
+ }
+
+ public function testWriteV2Notify()
+ {
+ $this->createHandler('myToken', 'room1', 'Monolog', true, 'hipchat.foo.bar', 'v2');
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/POST \/v2\/room\/room1\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
+
+ return $content;
+ }
+
+ public function testRoomSpaces()
+ {
+ $this->createHandler('myToken', 'room name', 'Monolog', false, 'hipchat.foo.bar', 'v2');
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/POST \/v2\/room\/room%20name\/notification\?auth_token=.* HTTP\/1.1\\r\\nHost: hipchat.foo.bar\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
+
+ return $content;
+ }
+
+ /**
+ * @depends testWriteHeader
+ */
+ public function testWriteContent($content)
+ {
+ $this->assertRegexp('/notify=0&message=test1&message_format=text&color=red&room_id=room1&from=Monolog$/', $content);
+ }
+
+ public function testWriteContentV1WithoutName()
+ {
+ $this->createHandler('myToken', 'room1', null, false, 'hipchat.foo.bar', 'v1');
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/notify=0&message=test1&message_format=text&color=red&room_id=room1&from=$/', $content);
+
+ return $content;
+ }
+
+ /**
+ * @depends testWriteCustomHostHeader
+ */
+ public function testWriteContentNotify($content)
+ {
+ $this->assertRegexp('/notify=1&message=test1&message_format=text&color=red&room_id=room1&from=Monolog$/', $content);
+ }
+
+ /**
+ * @depends testWriteV2
+ */
+ public function testWriteContentV2($content)
+ {
+ $this->assertRegexp('/notify=false&message=test1&message_format=text&color=red&from=Monolog$/', $content);
+ }
+
+ /**
+ * @depends testWriteV2Notify
+ */
+ public function testWriteContentV2Notify($content)
+ {
+ $this->assertRegexp('/notify=true&message=test1&message_format=text&color=red&from=Monolog$/', $content);
+ }
+
+ public function testWriteContentV2WithoutName()
+ {
+ $this->createHandler('myToken', 'room1', null, false, 'hipchat.foo.bar', 'v2');
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/notify=false&message=test1&message_format=text&color=red$/', $content);
+
+ return $content;
+ }
+
+ public function testWriteWithComplexMessage()
+ {
+ $this->createHandler();
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Backup of database "example" finished in 16 minutes.'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content);
+ }
+
+ public function testWriteTruncatesLongMessage()
+ {
+ $this->createHandler();
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, str_repeat('abcde', 2000)));
+ fseek($this->res, 0);
+ $content = fread($this->res, 12000);
+
+ $this->assertRegexp('/message='.str_repeat('abcde', 1900).'\+%5Btruncated%5D/', $content);
+ }
+
+ /**
+ * @dataProvider provideLevelColors
+ */
+ public function testWriteWithErrorLevelsAndColors($level, $expectedColor)
+ {
+ $this->createHandler();
+ $this->handler->handle($this->getRecord($level, 'Backup of database "example" finished in 16 minutes.'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/color='.$expectedColor.'/', $content);
+ }
+
+ public function provideLevelColors()
+ {
+ return array(
+ array(Logger::DEBUG, 'gray'),
+ array(Logger::INFO, 'green'),
+ array(Logger::WARNING, 'yellow'),
+ array(Logger::ERROR, 'red'),
+ array(Logger::CRITICAL, 'red'),
+ array(Logger::ALERT, 'red'),
+ array(Logger::EMERGENCY,'red'),
+ array(Logger::NOTICE, 'green'),
+ );
+ }
+
+ /**
+ * @dataProvider provideBatchRecords
+ */
+ public function testHandleBatch($records, $expectedColor)
+ {
+ $this->createHandler();
+
+ $this->handler->handleBatch($records);
+
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/color='.$expectedColor.'/', $content);
+ }
+
+ public function provideBatchRecords()
+ {
+ return array(
+ array(
+ array(
+ array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()),
+ array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()),
+ array('level' => Logger::CRITICAL, 'message' => 'Everything is broken!', 'level_name' => 'critical', 'datetime' => new \DateTime()),
+ ),
+ 'red',
+ ),
+ array(
+ array(
+ array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()),
+ array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()),
+ ),
+ 'yellow',
+ ),
+ array(
+ array(
+ array('level' => Logger::DEBUG, 'message' => 'Just debugging.', 'level_name' => 'debug', 'datetime' => new \DateTime()),
+ array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()),
+ ),
+ 'green',
+ ),
+ array(
+ array(
+ array('level' => Logger::DEBUG, 'message' => 'Just debugging.', 'level_name' => 'debug', 'datetime' => new \DateTime()),
+ ),
+ 'gray',
+ ),
+ );
+ }
+
+ private function createHandler($token = 'myToken', $room = 'room1', $name = 'Monolog', $notify = false, $host = 'api.hipchat.com', $version = 'v1')
+ {
+ $constructorArgs = array($token, $room, $name, $notify, Logger::DEBUG, true, true, 'text', $host, $version);
+ $this->res = fopen('php://memory', 'a');
+ $this->handler = $this->getMock(
+ '\Monolog\Handler\HipChatHandler',
+ array('fsockopen', 'streamSetTimeout', 'closeSocket'),
+ $constructorArgs
+ );
+
+ $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+ $reflectionProperty->setAccessible(true);
+ $reflectionProperty->setValue($this->handler, 'localhost:1234');
+
+ $this->handler->expects($this->any())
+ ->method('fsockopen')
+ ->will($this->returnValue($this->res));
+ $this->handler->expects($this->any())
+ ->method('streamSetTimeout')
+ ->will($this->returnValue(true));
+ $this->handler->expects($this->any())
+ ->method('closeSocket')
+ ->will($this->returnValue(true));
+
+ $this->handler->setFormatter($this->getIdentityFormatter());
+ }
+
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testCreateWithTooLongName()
+ {
+ $hipChatHandler = new HipChatHandler('token', 'room', 'SixteenCharsHere');
+ }
+
+ public function testCreateWithTooLongNameV2()
+ {
+ // creating a handler with too long of a name but using the v2 api doesn't matter.
+ $hipChatHandler = new HipChatHandler('token', 'room', 'SixteenCharsHere', false, Logger::CRITICAL, true, true, 'test', 'api.hipchat.com', 'v2');
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php
new file mode 100644
index 0000000..b2deb40
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php
@@ -0,0 +1,84 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+/**
+ * @author Robert Kaufmann III
+ */
+class LogEntriesHandlerTest extends TestCase
+{
+ /**
+ * @var resource
+ */
+ private $res;
+
+ /**
+ * @var LogEntriesHandler
+ */
+ private $handler;
+
+ public function testWriteContent()
+ {
+ $this->createHandler();
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Critical write test'));
+
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] test.CRITICAL: Critical write test/', $content);
+ }
+
+ public function testWriteBatchContent()
+ {
+ $records = array(
+ $this->getRecord(),
+ $this->getRecord(),
+ $this->getRecord(),
+ );
+ $this->createHandler();
+ $this->handler->handleBatch($records);
+
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/(testToken \[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\] .* \[\] \[\]\n){3}/', $content);
+ }
+
+ private function createHandler()
+ {
+ $useSSL = extension_loaded('openssl');
+ $args = array('testToken', $useSSL, Logger::DEBUG, true);
+ $this->res = fopen('php://memory', 'a');
+ $this->handler = $this->getMock(
+ '\Monolog\Handler\LogEntriesHandler',
+ array('fsockopen', 'streamSetTimeout', 'closeSocket'),
+ $args
+ );
+
+ $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+ $reflectionProperty->setAccessible(true);
+ $reflectionProperty->setValue($this->handler, 'localhost:1234');
+
+ $this->handler->expects($this->any())
+ ->method('fsockopen')
+ ->will($this->returnValue($this->res));
+ $this->handler->expects($this->any())
+ ->method('streamSetTimeout')
+ ->will($this->returnValue(true));
+ $this->handler->expects($this->any())
+ ->method('closeSocket')
+ ->will($this->returnValue(true));
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php
new file mode 100644
index 0000000..6754f3d
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/MailHandlerTest.php
@@ -0,0 +1,75 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\TestCase;
+
+class MailHandlerTest extends TestCase
+{
+ /**
+ * @covers Monolog\Handler\MailHandler::handleBatch
+ */
+ public function testHandleBatch()
+ {
+ $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
+ $formatter->expects($this->once())
+ ->method('formatBatch'); // Each record is formatted
+
+ $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler');
+ $handler->expects($this->once())
+ ->method('send');
+ $handler->expects($this->never())
+ ->method('write'); // write is for individual records
+
+ $handler->setFormatter($formatter);
+
+ $handler->handleBatch($this->getMultipleRecords());
+ }
+
+ /**
+ * @covers Monolog\Handler\MailHandler::handleBatch
+ */
+ public function testHandleBatchNotSendsMailIfMessagesAreBelowLevel()
+ {
+ $records = array(
+ $this->getRecord(Logger::DEBUG, 'debug message 1'),
+ $this->getRecord(Logger::DEBUG, 'debug message 2'),
+ $this->getRecord(Logger::INFO, 'information'),
+ );
+
+ $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler');
+ $handler->expects($this->never())
+ ->method('send');
+ $handler->setLevel(Logger::ERROR);
+
+ $handler->handleBatch($records);
+ }
+
+ /**
+ * @covers Monolog\Handler\MailHandler::write
+ */
+ public function testHandle()
+ {
+ $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler');
+
+ $record = $this->getRecord();
+ $records = array($record);
+ $records[0]['formatted'] = '['.$record['datetime']->format('Y-m-d H:i:s').'] test.WARNING: test [] []'."\n";
+
+ $handler->expects($this->once())
+ ->method('send')
+ ->with($records[0]['formatted'], $records);
+
+ $handler->handle($record);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php b/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php
new file mode 100644
index 0000000..a083322
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/MockRavenClient.php
@@ -0,0 +1,27 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Raven_Client;
+
+class MockRavenClient extends Raven_Client
+{
+ public function capture($data, $stack, $vars = null)
+ {
+ $data = array_merge($this->get_user_data(), $data);
+ $this->lastData = $data;
+ $this->lastStack = $stack;
+ }
+
+ public $lastData;
+ public $lastStack;
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php
new file mode 100644
index 0000000..0fdef63
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/MongoDBHandlerTest.php
@@ -0,0 +1,65 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+class MongoDBHandlerTest extends TestCase
+{
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testConstructorShouldThrowExceptionForInvalidMongo()
+ {
+ new MongoDBHandler(new \stdClass(), 'DB', 'Collection');
+ }
+
+ public function testHandle()
+ {
+ $mongo = $this->getMock('Mongo', array('selectCollection'), array(), '', false);
+ $collection = $this->getMock('stdClass', array('save'));
+
+ $mongo->expects($this->once())
+ ->method('selectCollection')
+ ->with('DB', 'Collection')
+ ->will($this->returnValue($collection));
+
+ $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
+
+ $expected = array(
+ 'message' => 'test',
+ 'context' => array('data' => '[object] (stdClass: {})', 'foo' => 34),
+ 'level' => Logger::WARNING,
+ 'level_name' => 'WARNING',
+ 'channel' => 'test',
+ 'datetime' => $record['datetime']->format('Y-m-d H:i:s'),
+ 'extra' => array(),
+ );
+
+ $collection->expects($this->once())
+ ->method('save')
+ ->with($expected);
+
+ $handler = new MongoDBHandler($mongo, 'DB', 'Collection');
+ $handler->handle($record);
+ }
+}
+
+if (!class_exists('Mongo')) {
+ class Mongo
+ {
+ public function selectCollection()
+ {
+ }
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php
new file mode 100644
index 0000000..ddf545d
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php
@@ -0,0 +1,111 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+use InvalidArgumentException;
+
+function mail($to, $subject, $message, $additional_headers = null, $additional_parameters = null)
+{
+ $GLOBALS['mail'][] = func_get_args();
+}
+
+class NativeMailerHandlerTest extends TestCase
+{
+ protected function setUp()
+ {
+ $GLOBALS['mail'] = array();
+ }
+
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testConstructorHeaderInjection()
+ {
+ $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', "receiver@example.org\r\nFrom: faked@attacker.org");
+ }
+
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testSetterHeaderInjection()
+ {
+ $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
+ $mailer->addHeader("Content-Type: text/html\r\nFrom: faked@attacker.org");
+ }
+
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testSetterArrayHeaderInjection()
+ {
+ $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
+ $mailer->addHeader(array("Content-Type: text/html\r\nFrom: faked@attacker.org"));
+ }
+
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testSetterContentTypeInjection()
+ {
+ $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
+ $mailer->setContentType("text/html\r\nFrom: faked@attacker.org");
+ }
+
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testSetterEncodingInjection()
+ {
+ $mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
+ $mailer->setEncoding("utf-8\r\nFrom: faked@attacker.org");
+ }
+
+ public function testSend()
+ {
+ $to = 'spammer@example.org';
+ $subject = 'dear victim';
+ $from = 'receiver@example.org';
+
+ $mailer = new NativeMailerHandler($to, $subject, $from);
+ $mailer->handleBatch(array());
+
+ // batch is empty, nothing sent
+ $this->assertEmpty($GLOBALS['mail']);
+
+ // non-empty batch
+ $mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz"));
+ $this->assertNotEmpty($GLOBALS['mail']);
+ $this->assertInternalType('array', $GLOBALS['mail']);
+ $this->assertArrayHasKey('0', $GLOBALS['mail']);
+ $params = $GLOBALS['mail'][0];
+ $this->assertCount(5, $params);
+ $this->assertSame($to, $params[0]);
+ $this->assertSame($subject, $params[1]);
+ $this->assertStringEndsWith(" test.ERROR: Foo Bar Baz [] []\n", $params[2]);
+ $this->assertSame("From: $from\r\nContent-type: text/plain; charset=utf-8\r\n", $params[3]);
+ $this->assertSame('', $params[4]);
+ }
+
+ public function testMessageSubjectFormatting()
+ {
+ $mailer = new NativeMailerHandler('to@example.org', 'Alert: %level_name% %message%', 'from@example.org');
+ $mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz"));
+ $this->assertNotEmpty($GLOBALS['mail']);
+ $this->assertInternalType('array', $GLOBALS['mail']);
+ $this->assertArrayHasKey('0', $GLOBALS['mail']);
+ $params = $GLOBALS['mail'][0];
+ $this->assertCount(5, $params);
+ $this->assertSame('Alert: ERROR Foo Bar Baz', $params[1]);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php
new file mode 100644
index 0000000..4d3a615
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php
@@ -0,0 +1,200 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Formatter\LineFormatter;
+use Monolog\TestCase;
+use Monolog\Logger;
+
+class NewRelicHandlerTest extends TestCase
+{
+ public static $appname;
+ public static $customParameters;
+ public static $transactionName;
+
+ public function setUp()
+ {
+ self::$appname = null;
+ self::$customParameters = array();
+ self::$transactionName = null;
+ }
+
+ /**
+ * @expectedException Monolog\Handler\MissingExtensionException
+ */
+ public function testThehandlerThrowsAnExceptionIfTheNRExtensionIsNotLoaded()
+ {
+ $handler = new StubNewRelicHandlerWithoutExtension();
+ $handler->handle($this->getRecord(Logger::ERROR));
+ }
+
+ public function testThehandlerCanHandleTheRecord()
+ {
+ $handler = new StubNewRelicHandler();
+ $handler->handle($this->getRecord(Logger::ERROR));
+ }
+
+ public function testThehandlerCanAddContextParamsToTheNewRelicTrace()
+ {
+ $handler = new StubNewRelicHandler();
+ $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('a' => 'b')));
+ $this->assertEquals(array('context_a' => 'b'), self::$customParameters);
+ }
+
+ public function testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace()
+ {
+ $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true);
+ $handler->handle($this->getRecord(
+ Logger::ERROR,
+ 'log message',
+ array('a' => array('key1' => 'value1', 'key2' => 'value2'))
+ ));
+ $this->assertEquals(
+ array('context_a_key1' => 'value1', 'context_a_key2' => 'value2'),
+ self::$customParameters
+ );
+ }
+
+ public function testThehandlerCanAddExtraParamsToTheNewRelicTrace()
+ {
+ $record = $this->getRecord(Logger::ERROR, 'log message');
+ $record['extra'] = array('c' => 'd');
+
+ $handler = new StubNewRelicHandler();
+ $handler->handle($record);
+
+ $this->assertEquals(array('extra_c' => 'd'), self::$customParameters);
+ }
+
+ public function testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace()
+ {
+ $record = $this->getRecord(Logger::ERROR, 'log message');
+ $record['extra'] = array('c' => array('key1' => 'value1', 'key2' => 'value2'));
+
+ $handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true);
+ $handler->handle($record);
+
+ $this->assertEquals(
+ array('extra_c_key1' => 'value1', 'extra_c_key2' => 'value2'),
+ self::$customParameters
+ );
+ }
+
+ public function testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace()
+ {
+ $record = $this->getRecord(Logger::ERROR, 'log message', array('a' => 'b'));
+ $record['extra'] = array('c' => 'd');
+
+ $handler = new StubNewRelicHandler();
+ $handler->handle($record);
+
+ $expected = array(
+ 'context_a' => 'b',
+ 'extra_c' => 'd',
+ );
+
+ $this->assertEquals($expected, self::$customParameters);
+ }
+
+ public function testThehandlerCanHandleTheRecordsFormattedUsingTheLineFormatter()
+ {
+ $handler = new StubNewRelicHandler();
+ $handler->setFormatter(new LineFormatter());
+ $handler->handle($this->getRecord(Logger::ERROR));
+ }
+
+ public function testTheAppNameIsNullByDefault()
+ {
+ $handler = new StubNewRelicHandler();
+ $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
+
+ $this->assertEquals(null, self::$appname);
+ }
+
+ public function testTheAppNameCanBeInjectedFromtheConstructor()
+ {
+ $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName');
+ $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
+
+ $this->assertEquals('myAppName', self::$appname);
+ }
+
+ public function testTheAppNameCanBeOverriddenFromEachLog()
+ {
+ $handler = new StubNewRelicHandler(Logger::DEBUG, false, 'myAppName');
+ $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('appname' => 'logAppName')));
+
+ $this->assertEquals('logAppName', self::$appname);
+ }
+
+ public function testTheTransactionNameIsNullByDefault()
+ {
+ $handler = new StubNewRelicHandler();
+ $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
+
+ $this->assertEquals(null, self::$transactionName);
+ }
+
+ public function testTheTransactionNameCanBeInjectedFromTheConstructor()
+ {
+ $handler = new StubNewRelicHandler(Logger::DEBUG, false, null, false, 'myTransaction');
+ $handler->handle($this->getRecord(Logger::ERROR, 'log message'));
+
+ $this->assertEquals('myTransaction', self::$transactionName);
+ }
+
+ public function testTheTransactionNameCanBeOverriddenFromEachLog()
+ {
+ $handler = new StubNewRelicHandler(Logger::DEBUG, false, null, false, 'myTransaction');
+ $handler->handle($this->getRecord(Logger::ERROR, 'log message', array('transaction_name' => 'logTransactName')));
+
+ $this->assertEquals('logTransactName', self::$transactionName);
+ }
+}
+
+class StubNewRelicHandlerWithoutExtension extends NewRelicHandler
+{
+ protected function isNewRelicEnabled()
+ {
+ return false;
+ }
+}
+
+class StubNewRelicHandler extends NewRelicHandler
+{
+ protected function isNewRelicEnabled()
+ {
+ return true;
+ }
+}
+
+function newrelic_notice_error()
+{
+ return true;
+}
+
+function newrelic_set_appname($appname)
+{
+ return NewRelicHandlerTest::$appname = $appname;
+}
+
+function newrelic_name_transaction($transactionName)
+{
+ return NewRelicHandlerTest::$transactionName = $transactionName;
+}
+
+function newrelic_add_custom_parameter($key, $value)
+{
+ NewRelicHandlerTest::$customParameters[$key] = $value;
+
+ return true;
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php
new file mode 100644
index 0000000..292df78
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/NullHandlerTest.php
@@ -0,0 +1,33 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+/**
+ * @covers Monolog\Handler\NullHandler::handle
+ */
+class NullHandlerTest extends TestCase
+{
+ public function testHandle()
+ {
+ $handler = new NullHandler();
+ $this->assertTrue($handler->handle($this->getRecord()));
+ }
+
+ public function testHandleLowerLevelRecord()
+ {
+ $handler = new NullHandler(Logger::WARNING);
+ $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php
new file mode 100644
index 0000000..152573e
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php
@@ -0,0 +1,273 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Exception;
+use Monolog\ErrorHandler;
+use Monolog\Logger;
+use Monolog\TestCase;
+use PhpConsole\Connector;
+use PhpConsole\Dispatcher\Debug as DebugDispatcher;
+use PhpConsole\Dispatcher\Errors as ErrorDispatcher;
+use PhpConsole\Handler;
+use PHPUnit_Framework_MockObject_MockObject;
+
+/**
+ * @covers Monolog\Handler\PHPConsoleHandler
+ * @author Sergey Barbushin https://www.linkedin.com/in/barbushin
+ */
+class PHPConsoleHandlerTest extends TestCase
+{
+ /** @var Connector|PHPUnit_Framework_MockObject_MockObject */
+ protected $connector;
+ /** @var DebugDispatcher|PHPUnit_Framework_MockObject_MockObject */
+ protected $debugDispatcher;
+ /** @var ErrorDispatcher|PHPUnit_Framework_MockObject_MockObject */
+ protected $errorDispatcher;
+
+ protected function setUp()
+ {
+ if (!class_exists('PhpConsole\Connector')) {
+ $this->markTestSkipped('PHP Console library not found. See https://github.com/barbushin/php-console#installation');
+ }
+ $this->connector = $this->initConnectorMock();
+
+ $this->debugDispatcher = $this->initDebugDispatcherMock($this->connector);
+ $this->connector->setDebugDispatcher($this->debugDispatcher);
+
+ $this->errorDispatcher = $this->initErrorDispatcherMock($this->connector);
+ $this->connector->setErrorsDispatcher($this->errorDispatcher);
+ }
+
+ protected function initDebugDispatcherMock(Connector $connector)
+ {
+ return $this->getMockBuilder('PhpConsole\Dispatcher\Debug')
+ ->disableOriginalConstructor()
+ ->setMethods(array('dispatchDebug'))
+ ->setConstructorArgs(array($connector, $connector->getDumper()))
+ ->getMock();
+ }
+
+ protected function initErrorDispatcherMock(Connector $connector)
+ {
+ return $this->getMockBuilder('PhpConsole\Dispatcher\Errors')
+ ->disableOriginalConstructor()
+ ->setMethods(array('dispatchError', 'dispatchException'))
+ ->setConstructorArgs(array($connector, $connector->getDumper()))
+ ->getMock();
+ }
+
+ protected function initConnectorMock()
+ {
+ $connector = $this->getMockBuilder('PhpConsole\Connector')
+ ->disableOriginalConstructor()
+ ->setMethods(array(
+ 'sendMessage',
+ 'onShutDown',
+ 'isActiveClient',
+ 'setSourcesBasePath',
+ 'setServerEncoding',
+ 'setPassword',
+ 'enableSslOnlyMode',
+ 'setAllowedIpMasks',
+ 'setHeadersLimit',
+ 'startEvalRequestsListener',
+ ))
+ ->getMock();
+
+ $connector->expects($this->any())
+ ->method('isActiveClient')
+ ->will($this->returnValue(true));
+
+ return $connector;
+ }
+
+ protected function getHandlerDefaultOption($name)
+ {
+ $handler = new PHPConsoleHandler(array(), $this->connector);
+ $options = $handler->getOptions();
+
+ return $options[$name];
+ }
+
+ protected function initLogger($handlerOptions = array(), $level = Logger::DEBUG)
+ {
+ return new Logger('test', array(
+ new PHPConsoleHandler($handlerOptions, $this->connector, $level),
+ ));
+ }
+
+ public function testInitWithDefaultConnector()
+ {
+ $handler = new PHPConsoleHandler();
+ $this->assertEquals(spl_object_hash(Connector::getInstance()), spl_object_hash($handler->getConnector()));
+ }
+
+ public function testInitWithCustomConnector()
+ {
+ $handler = new PHPConsoleHandler(array(), $this->connector);
+ $this->assertEquals(spl_object_hash($this->connector), spl_object_hash($handler->getConnector()));
+ }
+
+ public function testDebug()
+ {
+ $this->debugDispatcher->expects($this->once())->method('dispatchDebug')->with($this->equalTo('test'));
+ $this->initLogger()->addDebug('test');
+ }
+
+ public function testDebugContextInMessage()
+ {
+ $message = 'test';
+ $tag = 'tag';
+ $context = array($tag, 'custom' => mt_rand());
+ $expectedMessage = $message . ' ' . json_encode(array_slice($context, 1));
+ $this->debugDispatcher->expects($this->once())->method('dispatchDebug')->with(
+ $this->equalTo($expectedMessage),
+ $this->equalTo($tag)
+ );
+ $this->initLogger()->addDebug($message, $context);
+ }
+
+ public function testDebugTags($tagsContextKeys = null)
+ {
+ $expectedTags = mt_rand();
+ $logger = $this->initLogger($tagsContextKeys ? array('debugTagsKeysInContext' => $tagsContextKeys) : array());
+ if (!$tagsContextKeys) {
+ $tagsContextKeys = $this->getHandlerDefaultOption('debugTagsKeysInContext');
+ }
+ foreach ($tagsContextKeys as $key) {
+ $debugDispatcher = $this->initDebugDispatcherMock($this->connector);
+ $debugDispatcher->expects($this->once())->method('dispatchDebug')->with(
+ $this->anything(),
+ $this->equalTo($expectedTags)
+ );
+ $this->connector->setDebugDispatcher($debugDispatcher);
+ $logger->addDebug('test', array($key => $expectedTags));
+ }
+ }
+
+ public function testError($classesPartialsTraceIgnore = null)
+ {
+ $code = E_USER_NOTICE;
+ $message = 'message';
+ $file = __FILE__;
+ $line = __LINE__;
+ $this->errorDispatcher->expects($this->once())->method('dispatchError')->with(
+ $this->equalTo($code),
+ $this->equalTo($message),
+ $this->equalTo($file),
+ $this->equalTo($line),
+ $classesPartialsTraceIgnore ?: $this->equalTo($this->getHandlerDefaultOption('classesPartialsTraceIgnore'))
+ );
+ $errorHandler = ErrorHandler::register($this->initLogger($classesPartialsTraceIgnore ? array('classesPartialsTraceIgnore' => $classesPartialsTraceIgnore) : array()), false);
+ $errorHandler->registerErrorHandler(array(), false, E_USER_WARNING);
+ $errorHandler->handleError($code, $message, $file, $line);
+ }
+
+ public function testException()
+ {
+ $e = new Exception();
+ $this->errorDispatcher->expects($this->once())->method('dispatchException')->with(
+ $this->equalTo($e)
+ );
+ $handler = $this->initLogger();
+ $handler->log(
+ \Psr\Log\LogLevel::ERROR,
+ sprintf('Uncaught Exception %s: "%s" at %s line %s', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()),
+ array('exception' => $e)
+ );
+ }
+
+ /**
+ * @expectedException Exception
+ */
+ public function testWrongOptionsThrowsException()
+ {
+ new PHPConsoleHandler(array('xxx' => 1));
+ }
+
+ public function testOptionEnabled()
+ {
+ $this->debugDispatcher->expects($this->never())->method('dispatchDebug');
+ $this->initLogger(array('enabled' => false))->addDebug('test');
+ }
+
+ public function testOptionClassesPartialsTraceIgnore()
+ {
+ $this->testError(array('Class', 'Namespace\\'));
+ }
+
+ public function testOptionDebugTagsKeysInContext()
+ {
+ $this->testDebugTags(array('key1', 'key2'));
+ }
+
+ public function testOptionUseOwnErrorsAndExceptionsHandler()
+ {
+ $this->initLogger(array('useOwnErrorsHandler' => true, 'useOwnExceptionsHandler' => true));
+ $this->assertEquals(array(Handler::getInstance(), 'handleError'), set_error_handler(function () {
+ }));
+ $this->assertEquals(array(Handler::getInstance(), 'handleException'), set_exception_handler(function () {
+ }));
+ }
+
+ public static function provideConnectorMethodsOptionsSets()
+ {
+ return array(
+ array('sourcesBasePath', 'setSourcesBasePath', __DIR__),
+ array('serverEncoding', 'setServerEncoding', 'cp1251'),
+ array('password', 'setPassword', '******'),
+ array('enableSslOnlyMode', 'enableSslOnlyMode', true, false),
+ array('ipMasks', 'setAllowedIpMasks', array('127.0.0.*')),
+ array('headersLimit', 'setHeadersLimit', 2500),
+ array('enableEvalListener', 'startEvalRequestsListener', true, false),
+ );
+ }
+
+ /**
+ * @dataProvider provideConnectorMethodsOptionsSets
+ */
+ public function testOptionCallsConnectorMethod($option, $method, $value, $isArgument = true)
+ {
+ $expectCall = $this->connector->expects($this->once())->method($method);
+ if ($isArgument) {
+ $expectCall->with($value);
+ }
+ new PHPConsoleHandler(array($option => $value), $this->connector);
+ }
+
+ public function testOptionDetectDumpTraceAndSource()
+ {
+ new PHPConsoleHandler(array('detectDumpTraceAndSource' => true), $this->connector);
+ $this->assertTrue($this->connector->getDebugDispatcher()->detectTraceAndSource);
+ }
+
+ public static function provideDumperOptionsValues()
+ {
+ return array(
+ array('dumperLevelLimit', 'levelLimit', 1001),
+ array('dumperItemsCountLimit', 'itemsCountLimit', 1002),
+ array('dumperItemSizeLimit', 'itemSizeLimit', 1003),
+ array('dumperDumpSizeLimit', 'dumpSizeLimit', 1004),
+ array('dumperDetectCallbacks', 'detectCallbacks', true),
+ );
+ }
+
+ /**
+ * @dataProvider provideDumperOptionsValues
+ */
+ public function testDumperOptions($option, $dumperProperty, $value)
+ {
+ new PHPConsoleHandler(array($option => $value), $this->connector);
+ $this->assertEquals($value, $this->connector->getDumper()->$dumperProperty);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php
new file mode 100644
index 0000000..64eaab1
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/PsrHandlerTest.php
@@ -0,0 +1,50 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+/**
+ * @covers Monolog\Handler\PsrHandler::handle
+ */
+class PsrHandlerTest extends TestCase
+{
+ public function logLevelProvider()
+ {
+ $levels = array();
+ $monologLogger = new Logger('');
+
+ foreach ($monologLogger->getLevels() as $levelName => $level) {
+ $levels[] = array($levelName, $level);
+ }
+
+ return $levels;
+ }
+
+ /**
+ * @dataProvider logLevelProvider
+ */
+ public function testHandlesAllLevels($levelName, $level)
+ {
+ $message = 'Hello, world! ' . $level;
+ $context = array('foo' => 'bar', 'level' => $level);
+
+ $psrLogger = $this->getMock('Psr\Log\NullLogger');
+ $psrLogger->expects($this->once())
+ ->method('log')
+ ->with(strtolower($levelName), $message, $context);
+
+ $handler = new PsrHandler($psrLogger);
+ $handler->handle(array('level' => $level, 'level_name' => $levelName, 'message' => $message, 'context' => $context));
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php
new file mode 100644
index 0000000..56df474
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php
@@ -0,0 +1,141 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+/**
+ * Almost all examples (expected header, titles, messages) taken from
+ * https://www.pushover.net/api
+ * @author Sebastian Göttschkes
+ * @see https://www.pushover.net/api
+ */
+class PushoverHandlerTest extends TestCase
+{
+ private $res;
+ private $handler;
+
+ public function testWriteHeader()
+ {
+ $this->createHandler();
+ $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/POST \/1\/messages.json HTTP\/1.1\\r\\nHost: api.pushover.net\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
+
+ return $content;
+ }
+
+ /**
+ * @depends testWriteHeader
+ */
+ public function testWriteContent($content)
+ {
+ $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}$/', $content);
+ }
+
+ public function testWriteWithComplexTitle()
+ {
+ $this->createHandler('myToken', 'myUser', 'Backup finished - SQL1');
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/title=Backup\+finished\+-\+SQL1/', $content);
+ }
+
+ public function testWriteWithComplexMessage()
+ {
+ $this->createHandler();
+ $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'Backup of database "example" finished in 16 minutes.'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content);
+ }
+
+ public function testWriteWithTooLongMessage()
+ {
+ $message = str_pad('test', 520, 'a');
+ $this->createHandler();
+ $this->handler->setHighPriorityLevel(Logger::EMERGENCY); // skip priority notifications
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, $message));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $expectedMessage = substr($message, 0, 505);
+
+ $this->assertRegexp('/message=' . $expectedMessage . '&title/', $content);
+ }
+
+ public function testWriteWithHighPriority()
+ {
+ $this->createHandler();
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=1$/', $content);
+ }
+
+ public function testWriteWithEmergencyPriority()
+ {
+ $this->createHandler();
+ $this->handler->handle($this->getRecord(Logger::EMERGENCY, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content);
+ }
+
+ public function testWriteToMultipleUsers()
+ {
+ $this->createHandler('myToken', array('userA', 'userB'));
+ $this->handler->handle($this->getRecord(Logger::EMERGENCY, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/token=myToken&user=userA&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200POST/', $content);
+ $this->assertRegexp('/token=myToken&user=userB&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content);
+ }
+
+ private function createHandler($token = 'myToken', $user = 'myUser', $title = 'Monolog')
+ {
+ $constructorArgs = array($token, $user, $title);
+ $this->res = fopen('php://memory', 'a');
+ $this->handler = $this->getMock(
+ '\Monolog\Handler\PushoverHandler',
+ array('fsockopen', 'streamSetTimeout', 'closeSocket'),
+ $constructorArgs
+ );
+
+ $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+ $reflectionProperty->setAccessible(true);
+ $reflectionProperty->setValue($this->handler, 'localhost:1234');
+
+ $this->handler->expects($this->any())
+ ->method('fsockopen')
+ ->will($this->returnValue($this->res));
+ $this->handler->expects($this->any())
+ ->method('streamSetTimeout')
+ ->will($this->returnValue(true));
+ $this->handler->expects($this->any())
+ ->method('closeSocket')
+ ->will($this->returnValue(true));
+
+ $this->handler->setFormatter($this->getIdentityFormatter());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php
new file mode 100644
index 0000000..26d212b
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php
@@ -0,0 +1,255 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+use Monolog\Formatter\LineFormatter;
+
+class RavenHandlerTest extends TestCase
+{
+ public function setUp()
+ {
+ if (!class_exists('Raven_Client')) {
+ $this->markTestSkipped('raven/raven not installed');
+ }
+
+ require_once __DIR__ . '/MockRavenClient.php';
+ }
+
+ /**
+ * @covers Monolog\Handler\RavenHandler::__construct
+ */
+ public function testConstruct()
+ {
+ $handler = new RavenHandler($this->getRavenClient());
+ $this->assertInstanceOf('Monolog\Handler\RavenHandler', $handler);
+ }
+
+ protected function getHandler($ravenClient)
+ {
+ $handler = new RavenHandler($ravenClient);
+
+ return $handler;
+ }
+
+ protected function getRavenClient()
+ {
+ $dsn = 'http://43f6017361224d098402974103bfc53d:a6a0538fc2934ba2bed32e08741b2cd3@marca.python.live.cheggnet.com:9000/1';
+
+ return new MockRavenClient($dsn);
+ }
+
+ public function testDebug()
+ {
+ $ravenClient = $this->getRavenClient();
+ $handler = $this->getHandler($ravenClient);
+
+ $record = $this->getRecord(Logger::DEBUG, 'A test debug message');
+ $handler->handle($record);
+
+ $this->assertEquals($ravenClient::DEBUG, $ravenClient->lastData['level']);
+ $this->assertContains($record['message'], $ravenClient->lastData['message']);
+ }
+
+ public function testWarning()
+ {
+ $ravenClient = $this->getRavenClient();
+ $handler = $this->getHandler($ravenClient);
+
+ $record = $this->getRecord(Logger::WARNING, 'A test warning message');
+ $handler->handle($record);
+
+ $this->assertEquals($ravenClient::WARNING, $ravenClient->lastData['level']);
+ $this->assertContains($record['message'], $ravenClient->lastData['message']);
+ }
+
+ public function testTag()
+ {
+ $ravenClient = $this->getRavenClient();
+ $handler = $this->getHandler($ravenClient);
+
+ $tags = array(1, 2, 'foo');
+ $record = $this->getRecord(Logger::INFO, 'test', array('tags' => $tags));
+ $handler->handle($record);
+
+ $this->assertEquals($tags, $ravenClient->lastData['tags']);
+ }
+
+ public function testExtraParameters()
+ {
+ $ravenClient = $this->getRavenClient();
+ $handler = $this->getHandler($ravenClient);
+
+ $checksum = '098f6bcd4621d373cade4e832627b4f6';
+ $release = '05a671c66aefea124cc08b76ea6d30bb';
+ $eventId = '31423';
+ $record = $this->getRecord(Logger::INFO, 'test', array('checksum' => $checksum, 'release' => $release, 'event_id' => $eventId));
+ $handler->handle($record);
+
+ $this->assertEquals($checksum, $ravenClient->lastData['checksum']);
+ $this->assertEquals($release, $ravenClient->lastData['release']);
+ $this->assertEquals($eventId, $ravenClient->lastData['event_id']);
+ }
+
+ public function testFingerprint()
+ {
+ $ravenClient = $this->getRavenClient();
+ $handler = $this->getHandler($ravenClient);
+
+ $fingerprint = array('{{ default }}', 'other value');
+ $record = $this->getRecord(Logger::INFO, 'test', array('fingerprint' => $fingerprint));
+ $handler->handle($record);
+
+ $this->assertEquals($fingerprint, $ravenClient->lastData['fingerprint']);
+ }
+
+ public function testUserContext()
+ {
+ $ravenClient = $this->getRavenClient();
+ $handler = $this->getHandler($ravenClient);
+
+ $recordWithNoContext = $this->getRecord(Logger::INFO, 'test with default user context');
+ // set user context 'externally'
+
+ $user = array(
+ 'id' => '123',
+ 'email' => 'test@test.com',
+ );
+
+ $recordWithContext = $this->getRecord(Logger::INFO, 'test', array('user' => $user));
+
+ $ravenClient->user_context(array('id' => 'test_user_id'));
+ // handle context
+ $handler->handle($recordWithContext);
+ $this->assertEquals($user, $ravenClient->lastData['user']);
+
+ // check to see if its reset
+ $handler->handle($recordWithNoContext);
+ $this->assertInternalType('array', $ravenClient->context->user);
+ $this->assertSame('test_user_id', $ravenClient->context->user['id']);
+
+ // handle with null context
+ $ravenClient->user_context(null);
+ $handler->handle($recordWithContext);
+ $this->assertEquals($user, $ravenClient->lastData['user']);
+
+ // check to see if its reset
+ $handler->handle($recordWithNoContext);
+ $this->assertNull($ravenClient->context->user);
+ }
+
+ public function testException()
+ {
+ $ravenClient = $this->getRavenClient();
+ $handler = $this->getHandler($ravenClient);
+
+ try {
+ $this->methodThatThrowsAnException();
+ } catch (\Exception $e) {
+ $record = $this->getRecord(Logger::ERROR, $e->getMessage(), array('exception' => $e));
+ $handler->handle($record);
+ }
+
+ $this->assertEquals($record['message'], $ravenClient->lastData['message']);
+ }
+
+ public function testHandleBatch()
+ {
+ $records = $this->getMultipleRecords();
+ $records[] = $this->getRecord(Logger::WARNING, 'warning');
+ $records[] = $this->getRecord(Logger::WARNING, 'warning');
+
+ $logFormatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
+ $logFormatter->expects($this->once())->method('formatBatch');
+
+ $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
+ $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) {
+ return $record['level'] == 400;
+ }));
+
+ $handler = $this->getHandler($this->getRavenClient());
+ $handler->setBatchFormatter($logFormatter);
+ $handler->setFormatter($formatter);
+ $handler->handleBatch($records);
+ }
+
+ public function testHandleBatchDoNothingIfRecordsAreBelowLevel()
+ {
+ $records = array(
+ $this->getRecord(Logger::DEBUG, 'debug message 1'),
+ $this->getRecord(Logger::DEBUG, 'debug message 2'),
+ $this->getRecord(Logger::INFO, 'information'),
+ );
+
+ $handler = $this->getMock('Monolog\Handler\RavenHandler', null, array($this->getRavenClient()));
+ $handler->expects($this->never())->method('handle');
+ $handler->setLevel(Logger::ERROR);
+ $handler->handleBatch($records);
+ }
+
+ public function testHandleBatchPicksProperMessage()
+ {
+ $records = array(
+ $this->getRecord(Logger::DEBUG, 'debug message 1'),
+ $this->getRecord(Logger::DEBUG, 'debug message 2'),
+ $this->getRecord(Logger::INFO, 'information 1'),
+ $this->getRecord(Logger::ERROR, 'error 1'),
+ $this->getRecord(Logger::WARNING, 'warning'),
+ $this->getRecord(Logger::ERROR, 'error 2'),
+ $this->getRecord(Logger::INFO, 'information 2'),
+ );
+
+ $logFormatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
+ $logFormatter->expects($this->once())->method('formatBatch');
+
+ $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
+ $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) use ($records) {
+ return $record['message'] == 'error 1';
+ }));
+
+ $handler = $this->getHandler($this->getRavenClient());
+ $handler->setBatchFormatter($logFormatter);
+ $handler->setFormatter($formatter);
+ $handler->handleBatch($records);
+ }
+
+ public function testGetSetBatchFormatter()
+ {
+ $ravenClient = $this->getRavenClient();
+ $handler = $this->getHandler($ravenClient);
+
+ $handler->setBatchFormatter($formatter = new LineFormatter());
+ $this->assertSame($formatter, $handler->getBatchFormatter());
+ }
+
+ public function testRelease()
+ {
+ $ravenClient = $this->getRavenClient();
+ $handler = $this->getHandler($ravenClient);
+ $release = 'v42.42.42';
+ $handler->setRelease($release);
+ $record = $this->getRecord(Logger::INFO, 'test');
+ $handler->handle($record);
+ $this->assertEquals($release, $ravenClient->lastData['release']);
+
+ $localRelease = 'v41.41.41';
+ $record = $this->getRecord(Logger::INFO, 'test', array('release' => $localRelease));
+ $handler->handle($record);
+ $this->assertEquals($localRelease, $ravenClient->lastData['release']);
+ }
+
+ private function methodThatThrowsAnException()
+ {
+ throw new \Exception('This is an exception');
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php
new file mode 100644
index 0000000..689d527
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php
@@ -0,0 +1,127 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+use Monolog\Formatter\LineFormatter;
+
+class RedisHandlerTest extends TestCase
+{
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testConstructorShouldThrowExceptionForInvalidRedis()
+ {
+ new RedisHandler(new \stdClass(), 'key');
+ }
+
+ public function testConstructorShouldWorkWithPredis()
+ {
+ $redis = $this->getMock('Predis\Client');
+ $this->assertInstanceof('Monolog\Handler\RedisHandler', new RedisHandler($redis, 'key'));
+ }
+
+ public function testConstructorShouldWorkWithRedis()
+ {
+ $redis = $this->getMock('Redis');
+ $this->assertInstanceof('Monolog\Handler\RedisHandler', new RedisHandler($redis, 'key'));
+ }
+
+ public function testPredisHandle()
+ {
+ $redis = $this->getMock('Predis\Client', array('rpush'));
+
+ // Predis\Client uses rpush
+ $redis->expects($this->once())
+ ->method('rpush')
+ ->with('key', 'test');
+
+ $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
+
+ $handler = new RedisHandler($redis, 'key');
+ $handler->setFormatter(new LineFormatter("%message%"));
+ $handler->handle($record);
+ }
+
+ public function testRedisHandle()
+ {
+ $redis = $this->getMock('Redis', array('rpush'));
+
+ // Redis uses rPush
+ $redis->expects($this->once())
+ ->method('rPush')
+ ->with('key', 'test');
+
+ $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
+
+ $handler = new RedisHandler($redis, 'key');
+ $handler->setFormatter(new LineFormatter("%message%"));
+ $handler->handle($record);
+ }
+
+ public function testRedisHandleCapped()
+ {
+ $redis = $this->getMock('Redis', array('multi', 'rpush', 'ltrim', 'exec'));
+
+ // Redis uses multi
+ $redis->expects($this->once())
+ ->method('multi')
+ ->will($this->returnSelf());
+
+ $redis->expects($this->once())
+ ->method('rpush')
+ ->will($this->returnSelf());
+
+ $redis->expects($this->once())
+ ->method('ltrim')
+ ->will($this->returnSelf());
+
+ $redis->expects($this->once())
+ ->method('exec')
+ ->will($this->returnSelf());
+
+ $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
+
+ $handler = new RedisHandler($redis, 'key', Logger::DEBUG, true, 10);
+ $handler->setFormatter(new LineFormatter("%message%"));
+ $handler->handle($record);
+ }
+
+ public function testPredisHandleCapped()
+ {
+ $redis = $this->getMock('Predis\Client', array('transaction'));
+
+ $redisTransaction = $this->getMock('Predis\Client', array('rpush', 'ltrim'));
+
+ $redisTransaction->expects($this->once())
+ ->method('rpush')
+ ->will($this->returnSelf());
+
+ $redisTransaction->expects($this->once())
+ ->method('ltrim')
+ ->will($this->returnSelf());
+
+ // Redis uses multi
+ $redis->expects($this->once())
+ ->method('transaction')
+ ->will($this->returnCallback(function ($cb) use ($redisTransaction) {
+ $cb($redisTransaction);
+ }));
+
+ $record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
+
+ $handler = new RedisHandler($redis, 'key', Logger::DEBUG, true, 10);
+ $handler->setFormatter(new LineFormatter("%message%"));
+ $handler->handle($record);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php
new file mode 100644
index 0000000..f302e91
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php
@@ -0,0 +1,84 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Exception;
+use Monolog\TestCase;
+use Monolog\Logger;
+use PHPUnit_Framework_MockObject_MockObject as MockObject;
+
+/**
+ * @author Erik Johansson
+ * @see https://rollbar.com/docs/notifier/rollbar-php/
+ *
+ * @coversDefaultClass Monolog\Handler\RollbarHandler
+ */
+class RollbarHandlerTest extends TestCase
+{
+ /**
+ * @var MockObject
+ */
+ private $rollbarNotifier;
+
+ /**
+ * @var array
+ */
+ public $reportedExceptionArguments = null;
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->setupRollbarNotifierMock();
+ }
+
+ /**
+ * When reporting exceptions to Rollbar the
+ * level has to be set in the payload data
+ */
+ public function testExceptionLogLevel()
+ {
+ $handler = $this->createHandler();
+
+ $handler->handle($this->createExceptionRecord(Logger::DEBUG));
+
+ $this->assertEquals('debug', $this->reportedExceptionArguments['payload']['level']);
+ }
+
+ private function setupRollbarNotifierMock()
+ {
+ $this->rollbarNotifier = $this->getMockBuilder('RollbarNotifier')
+ ->setMethods(array('report_message', 'report_exception', 'flush'))
+ ->getMock();
+
+ $that = $this;
+
+ $this->rollbarNotifier
+ ->expects($this->any())
+ ->method('report_exception')
+ ->willReturnCallback(function ($exception, $context, $payload) use ($that) {
+ $that->reportedExceptionArguments = compact('exception', 'context', 'payload');
+ });
+ }
+
+ private function createHandler()
+ {
+ return new RollbarHandler($this->rollbarNotifier, Logger::DEBUG);
+ }
+
+ private function createExceptionRecord($level = Logger::DEBUG, $message = 'test', $exception = null)
+ {
+ return $this->getRecord($level, $message, array(
+ 'exception' => $exception ?: new Exception()
+ ));
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php
new file mode 100644
index 0000000..f1feb22
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php
@@ -0,0 +1,211 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use PHPUnit_Framework_Error_Deprecated;
+
+/**
+ * @covers Monolog\Handler\RotatingFileHandler
+ */
+class RotatingFileHandlerTest extends TestCase
+{
+ /**
+ * This var should be private but then the anonymous function
+ * in the `setUp` method won't be able to set it. `$this` cant't
+ * be used in the anonymous function in `setUp` because PHP 5.3
+ * does not support it.
+ */
+ public $lastError;
+
+ public function setUp()
+ {
+ $dir = __DIR__.'/Fixtures';
+ chmod($dir, 0777);
+ if (!is_writable($dir)) {
+ $this->markTestSkipped($dir.' must be writable to test the RotatingFileHandler.');
+ }
+ $this->lastError = null;
+ $self = $this;
+ // workaround with &$self used for PHP 5.3
+ set_error_handler(function($code, $message) use (&$self) {
+ $self->lastError = array(
+ 'code' => $code,
+ 'message' => $message,
+ );
+ });
+ }
+
+ private function assertErrorWasTriggered($code, $message)
+ {
+ if (empty($this->lastError)) {
+ $this->fail(
+ sprintf(
+ 'Failed asserting that error with code `%d` and message `%s` was triggered',
+ $code,
+ $message
+ )
+ );
+ }
+ $this->assertEquals($code, $this->lastError['code'], sprintf('Expected an error with code %d to be triggered, got `%s` instead', $code, $this->lastError['code']));
+ $this->assertEquals($message, $this->lastError['message'], sprintf('Expected an error with message `%d` to be triggered, got `%s` instead', $message, $this->lastError['message']));
+ }
+
+ public function testRotationCreatesNewFile()
+ {
+ touch(__DIR__.'/Fixtures/foo-'.date('Y-m-d', time() - 86400).'.rot');
+
+ $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot');
+ $handler->setFormatter($this->getIdentityFormatter());
+ $handler->handle($this->getRecord());
+
+ $log = __DIR__.'/Fixtures/foo-'.date('Y-m-d').'.rot';
+ $this->assertTrue(file_exists($log));
+ $this->assertEquals('test', file_get_contents($log));
+ }
+
+ /**
+ * @dataProvider rotationTests
+ */
+ public function testRotation($createFile, $dateFormat, $timeCallback)
+ {
+ touch($old1 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-1)).'.rot');
+ touch($old2 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-2)).'.rot');
+ touch($old3 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-3)).'.rot');
+ touch($old4 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-4)).'.rot');
+
+ $log = __DIR__.'/Fixtures/foo-'.date($dateFormat).'.rot';
+
+ if ($createFile) {
+ touch($log);
+ }
+
+ $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
+ $handler->setFormatter($this->getIdentityFormatter());
+ $handler->setFilenameFormat('{filename}-{date}', $dateFormat);
+ $handler->handle($this->getRecord());
+
+ $handler->close();
+
+ $this->assertTrue(file_exists($log));
+ $this->assertTrue(file_exists($old1));
+ $this->assertEquals($createFile, file_exists($old2));
+ $this->assertEquals($createFile, file_exists($old3));
+ $this->assertEquals($createFile, file_exists($old4));
+ $this->assertEquals('test', file_get_contents($log));
+ }
+
+ public function rotationTests()
+ {
+ $now = time();
+ $dayCallback = function($ago) use ($now) {
+ return $now + 86400 * $ago;
+ };
+ $monthCallback = function($ago) {
+ return gmmktime(0, 0, 0, date('n') + $ago, 1, date('Y'));
+ };
+ $yearCallback = function($ago) {
+ return gmmktime(0, 0, 0, 1, 1, date('Y') + $ago);
+ };
+
+ return array(
+ 'Rotation is triggered when the file of the current day is not present'
+ => array(true, RotatingFileHandler::FILE_PER_DAY, $dayCallback),
+ 'Rotation is not triggered when the file of the current day is already present'
+ => array(false, RotatingFileHandler::FILE_PER_DAY, $dayCallback),
+
+ 'Rotation is triggered when the file of the current month is not present'
+ => array(true, RotatingFileHandler::FILE_PER_MONTH, $monthCallback),
+ 'Rotation is not triggered when the file of the current month is already present'
+ => array(false, RotatingFileHandler::FILE_PER_MONTH, $monthCallback),
+
+ 'Rotation is triggered when the file of the current year is not present'
+ => array(true, RotatingFileHandler::FILE_PER_YEAR, $yearCallback),
+ 'Rotation is not triggered when the file of the current year is already present'
+ => array(false, RotatingFileHandler::FILE_PER_YEAR, $yearCallback),
+ );
+ }
+
+ /**
+ * @dataProvider dateFormatProvider
+ */
+ public function testAllowOnlyFixedDefinedDateFormats($dateFormat, $valid)
+ {
+ $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
+ $handler->setFilenameFormat('{filename}-{date}', $dateFormat);
+ if (!$valid) {
+ $this->assertErrorWasTriggered(
+ E_USER_DEPRECATED,
+ 'Invalid date format - format must be one of RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), '.
+ 'RotatingFileHandler::FILE_PER_MONTH ("Y-m") or RotatingFileHandler::FILE_PER_YEAR ("Y"), '.
+ 'or you can set one of the date formats using slashes, underscores and/or dots instead of dashes.'
+ );
+ }
+ }
+
+ public function dateFormatProvider()
+ {
+ return array(
+ array(RotatingFileHandler::FILE_PER_DAY, true),
+ array(RotatingFileHandler::FILE_PER_MONTH, true),
+ array(RotatingFileHandler::FILE_PER_YEAR, true),
+ array('m-d-Y', false),
+ array('Y-m-d-h-i', false)
+ );
+ }
+
+ /**
+ * @dataProvider filenameFormatProvider
+ */
+ public function testDisallowFilenameFormatsWithoutDate($filenameFormat, $valid)
+ {
+ $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
+ $handler->setFilenameFormat($filenameFormat, RotatingFileHandler::FILE_PER_DAY);
+ if (!$valid) {
+ $this->assertErrorWasTriggered(
+ E_USER_DEPRECATED,
+ 'Invalid filename format - format should contain at least `{date}`, because otherwise rotating is impossible.'
+ );
+ }
+ }
+
+ public function filenameFormatProvider()
+ {
+ return array(
+ array('{filename}', false),
+ array('{filename}-{date}', true),
+ array('{date}', true),
+ array('foobar-{date}', true),
+ array('foo-{date}-bar', true),
+ array('{date}-foobar', true),
+ array('foobar', false),
+ );
+ }
+
+ public function testReuseCurrentFile()
+ {
+ $log = __DIR__.'/Fixtures/foo-'.date('Y-m-d').'.rot';
+ file_put_contents($log, "foo");
+ $handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot');
+ $handler->setFormatter($this->getIdentityFormatter());
+ $handler->handle($this->getRecord());
+ $this->assertEquals('footest', file_get_contents($log));
+ }
+
+ public function tearDown()
+ {
+ foreach (glob(__DIR__.'/Fixtures/*.rot') as $file) {
+ unlink($file);
+ }
+ restore_error_handler();
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php
new file mode 100644
index 0000000..b354cee
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/SamplingHandlerTest.php
@@ -0,0 +1,33 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+
+/**
+ * @covers Monolog\Handler\SamplingHandler::handle
+ */
+class SamplingHandlerTest extends TestCase
+{
+ public function testHandle()
+ {
+ $testHandler = new TestHandler();
+ $handler = new SamplingHandler($testHandler, 2);
+ for ($i = 0; $i < 10000; $i++) {
+ $handler->handle($this->getRecord());
+ }
+ $count = count($testHandler->getRecords());
+ // $count should be half of 10k, so between 4k and 6k
+ $this->assertLessThan(6000, $count);
+ $this->assertGreaterThan(4000, $count);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php
new file mode 100644
index 0000000..e1aa96d
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php
@@ -0,0 +1,387 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler\Slack;
+
+use Monolog\Logger;
+use Monolog\TestCase;
+
+/**
+ * @coversDefaultClass Monolog\Handler\Slack\SlackRecord
+ */
+class SlackRecordTest extends TestCase
+{
+ private $jsonPrettyPrintFlag;
+
+ protected function setUp()
+ {
+ $this->jsonPrettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128;
+ }
+
+ public function dataGetAttachmentColor()
+ {
+ return array(
+ array(Logger::DEBUG, SlackRecord::COLOR_DEFAULT),
+ array(Logger::INFO, SlackRecord::COLOR_GOOD),
+ array(Logger::NOTICE, SlackRecord::COLOR_GOOD),
+ array(Logger::WARNING, SlackRecord::COLOR_WARNING),
+ array(Logger::ERROR, SlackRecord::COLOR_DANGER),
+ array(Logger::CRITICAL, SlackRecord::COLOR_DANGER),
+ array(Logger::ALERT, SlackRecord::COLOR_DANGER),
+ array(Logger::EMERGENCY, SlackRecord::COLOR_DANGER),
+ );
+ }
+
+ /**
+ * @dataProvider dataGetAttachmentColor
+ * @param int $logLevel
+ * @param string $expectedColour RGB hex color or name of Slack color
+ * @covers ::getAttachmentColor
+ */
+ public function testGetAttachmentColor($logLevel, $expectedColour)
+ {
+ $slackRecord = new SlackRecord();
+ $this->assertSame(
+ $expectedColour,
+ $slackRecord->getAttachmentColor($logLevel)
+ );
+ }
+
+ public function testAddsChannel()
+ {
+ $channel = '#test';
+ $record = new SlackRecord($channel);
+ $data = $record->getSlackData($this->getRecord());
+
+ $this->assertArrayHasKey('channel', $data);
+ $this->assertSame($channel, $data['channel']);
+ }
+
+ public function testNoUsernameByDefault()
+ {
+ $record = new SlackRecord();
+ $data = $record->getSlackData($this->getRecord());
+
+ $this->assertArrayNotHasKey('username', $data);
+ }
+
+ /**
+ * @return array
+ */
+ public function dataStringify()
+ {
+ $jsonPrettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128;
+
+ $multipleDimensions = array(array(1, 2));
+ $numericKeys = array('library' => 'monolog');
+ $singleDimension = array(1, 'Hello', 'Jordi');
+
+ return array(
+ array(array(), '[]'),
+ array($multipleDimensions, json_encode($multipleDimensions, $jsonPrettyPrintFlag)),
+ array($numericKeys, json_encode($numericKeys, $jsonPrettyPrintFlag)),
+ array($singleDimension, json_encode($singleDimension))
+ );
+ }
+
+ /**
+ * @dataProvider dataStringify
+ */
+ public function testStringify($fields, $expectedResult)
+ {
+ $slackRecord = new SlackRecord(
+ '#test',
+ 'test',
+ true,
+ null,
+ true,
+ true
+ );
+
+ $this->assertSame($expectedResult, $slackRecord->stringify($fields));
+ }
+
+ public function testAddsCustomUsername()
+ {
+ $username = 'Monolog bot';
+ $record = new SlackRecord(null, $username);
+ $data = $record->getSlackData($this->getRecord());
+
+ $this->assertArrayHasKey('username', $data);
+ $this->assertSame($username, $data['username']);
+ }
+
+ public function testNoIcon()
+ {
+ $record = new SlackRecord();
+ $data = $record->getSlackData($this->getRecord());
+
+ $this->assertArrayNotHasKey('icon_emoji', $data);
+ }
+
+ public function testAddsIcon()
+ {
+ $record = $this->getRecord();
+ $slackRecord = new SlackRecord(null, null, false, 'ghost');
+ $data = $slackRecord->getSlackData($record);
+
+ $slackRecord2 = new SlackRecord(null, null, false, 'http://github.com/Seldaek/monolog');
+ $data2 = $slackRecord2->getSlackData($record);
+
+ $this->assertArrayHasKey('icon_emoji', $data);
+ $this->assertSame(':ghost:', $data['icon_emoji']);
+ $this->assertArrayHasKey('icon_url', $data2);
+ $this->assertSame('http://github.com/Seldaek/monolog', $data2['icon_url']);
+ }
+
+ public function testAttachmentsNotPresentIfNoAttachment()
+ {
+ $record = new SlackRecord(null, null, false);
+ $data = $record->getSlackData($this->getRecord());
+
+ $this->assertArrayNotHasKey('attachments', $data);
+ }
+
+ public function testAddsOneAttachment()
+ {
+ $record = new SlackRecord();
+ $data = $record->getSlackData($this->getRecord());
+
+ $this->assertArrayHasKey('attachments', $data);
+ $this->assertArrayHasKey(0, $data['attachments']);
+ $this->assertInternalType('array', $data['attachments'][0]);
+ }
+
+ public function testTextEqualsMessageIfNoAttachment()
+ {
+ $message = 'Test message';
+ $record = new SlackRecord(null, null, false);
+ $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message));
+
+ $this->assertArrayHasKey('text', $data);
+ $this->assertSame($message, $data['text']);
+ }
+
+ public function testTextEqualsFormatterOutput()
+ {
+ $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
+ $formatter
+ ->expects($this->any())
+ ->method('format')
+ ->will($this->returnCallback(function ($record) { return $record['message'] . 'test'; }));
+
+ $formatter2 = $this->getMock('Monolog\\Formatter\\FormatterInterface');
+ $formatter2
+ ->expects($this->any())
+ ->method('format')
+ ->will($this->returnCallback(function ($record) { return $record['message'] . 'test1'; }));
+
+ $message = 'Test message';
+ $record = new SlackRecord(null, null, false, null, false, false, array(), $formatter);
+ $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message));
+
+ $this->assertArrayHasKey('text', $data);
+ $this->assertSame($message . 'test', $data['text']);
+
+ $record->setFormatter($formatter2);
+ $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message));
+
+ $this->assertArrayHasKey('text', $data);
+ $this->assertSame($message . 'test1', $data['text']);
+ }
+
+ public function testAddsFallbackAndTextToAttachment()
+ {
+ $message = 'Test message';
+ $record = new SlackRecord(null);
+ $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message));
+
+ $this->assertSame($message, $data['attachments'][0]['text']);
+ $this->assertSame($message, $data['attachments'][0]['fallback']);
+ }
+
+ public function testMapsLevelToColorAttachmentColor()
+ {
+ $record = new SlackRecord(null);
+ $errorLoggerRecord = $this->getRecord(Logger::ERROR);
+ $emergencyLoggerRecord = $this->getRecord(Logger::EMERGENCY);
+ $warningLoggerRecord = $this->getRecord(Logger::WARNING);
+ $infoLoggerRecord = $this->getRecord(Logger::INFO);
+ $debugLoggerRecord = $this->getRecord(Logger::DEBUG);
+
+ $data = $record->getSlackData($errorLoggerRecord);
+ $this->assertSame(SlackRecord::COLOR_DANGER, $data['attachments'][0]['color']);
+
+ $data = $record->getSlackData($emergencyLoggerRecord);
+ $this->assertSame(SlackRecord::COLOR_DANGER, $data['attachments'][0]['color']);
+
+ $data = $record->getSlackData($warningLoggerRecord);
+ $this->assertSame(SlackRecord::COLOR_WARNING, $data['attachments'][0]['color']);
+
+ $data = $record->getSlackData($infoLoggerRecord);
+ $this->assertSame(SlackRecord::COLOR_GOOD, $data['attachments'][0]['color']);
+
+ $data = $record->getSlackData($debugLoggerRecord);
+ $this->assertSame(SlackRecord::COLOR_DEFAULT, $data['attachments'][0]['color']);
+ }
+
+ public function testAddsShortAttachmentWithoutContextAndExtra()
+ {
+ $level = Logger::ERROR;
+ $levelName = Logger::getLevelName($level);
+ $record = new SlackRecord(null, null, true, null, true);
+ $data = $record->getSlackData($this->getRecord($level, 'test', array('test' => 1)));
+
+ $attachment = $data['attachments'][0];
+ $this->assertArrayHasKey('title', $attachment);
+ $this->assertArrayHasKey('fields', $attachment);
+ $this->assertSame($levelName, $attachment['title']);
+ $this->assertSame(array(), $attachment['fields']);
+ }
+
+ public function testAddsShortAttachmentWithContextAndExtra()
+ {
+ $level = Logger::ERROR;
+ $levelName = Logger::getLevelName($level);
+ $context = array('test' => 1);
+ $extra = array('tags' => array('web'));
+ $record = new SlackRecord(null, null, true, null, true, true);
+ $loggerRecord = $this->getRecord($level, 'test', $context);
+ $loggerRecord['extra'] = $extra;
+ $data = $record->getSlackData($loggerRecord);
+
+ $attachment = $data['attachments'][0];
+ $this->assertArrayHasKey('title', $attachment);
+ $this->assertArrayHasKey('fields', $attachment);
+ $this->assertCount(2, $attachment['fields']);
+ $this->assertSame($levelName, $attachment['title']);
+ $this->assertSame(
+ array(
+ array(
+ 'title' => 'Extra',
+ 'value' => sprintf('```%s```', json_encode($extra, $this->jsonPrettyPrintFlag)),
+ 'short' => false
+ ),
+ array(
+ 'title' => 'Context',
+ 'value' => sprintf('```%s```', json_encode($context, $this->jsonPrettyPrintFlag)),
+ 'short' => false
+ )
+ ),
+ $attachment['fields']
+ );
+ }
+
+ public function testAddsLongAttachmentWithoutContextAndExtra()
+ {
+ $level = Logger::ERROR;
+ $levelName = Logger::getLevelName($level);
+ $record = new SlackRecord(null, null, true, null);
+ $data = $record->getSlackData($this->getRecord($level, 'test', array('test' => 1)));
+
+ $attachment = $data['attachments'][0];
+ $this->assertArrayHasKey('title', $attachment);
+ $this->assertArrayHasKey('fields', $attachment);
+ $this->assertCount(1, $attachment['fields']);
+ $this->assertSame('Message', $attachment['title']);
+ $this->assertSame(
+ array(array(
+ 'title' => 'Level',
+ 'value' => $levelName,
+ 'short' => false
+ )),
+ $attachment['fields']
+ );
+ }
+
+ public function testAddsLongAttachmentWithContextAndExtra()
+ {
+ $level = Logger::ERROR;
+ $levelName = Logger::getLevelName($level);
+ $context = array('test' => 1);
+ $extra = array('tags' => array('web'));
+ $record = new SlackRecord(null, null, true, null, false, true);
+ $loggerRecord = $this->getRecord($level, 'test', $context);
+ $loggerRecord['extra'] = $extra;
+ $data = $record->getSlackData($loggerRecord);
+
+ $expectedFields = array(
+ array(
+ 'title' => 'Level',
+ 'value' => $levelName,
+ 'short' => false,
+ ),
+ array(
+ 'title' => 'tags',
+ 'value' => sprintf('```%s```', json_encode($extra['tags'])),
+ 'short' => false
+ ),
+ array(
+ 'title' => 'test',
+ 'value' => $context['test'],
+ 'short' => false
+ )
+ );
+
+ $attachment = $data['attachments'][0];
+ $this->assertArrayHasKey('title', $attachment);
+ $this->assertArrayHasKey('fields', $attachment);
+ $this->assertCount(3, $attachment['fields']);
+ $this->assertSame('Message', $attachment['title']);
+ $this->assertSame(
+ $expectedFields,
+ $attachment['fields']
+ );
+ }
+
+ public function testAddsTimestampToAttachment()
+ {
+ $record = $this->getRecord();
+ $slackRecord = new SlackRecord();
+ $data = $slackRecord->getSlackData($this->getRecord());
+
+ $attachment = $data['attachments'][0];
+ $this->assertArrayHasKey('ts', $attachment);
+ $this->assertSame($record['datetime']->getTimestamp(), $attachment['ts']);
+ }
+
+ public function testExcludeExtraAndContextFields()
+ {
+ $record = $this->getRecord(
+ Logger::WARNING,
+ 'test',
+ array('info' => array('library' => 'monolog', 'author' => 'Jordi'))
+ );
+ $record['extra'] = array('tags' => array('web', 'cli'));
+
+ $slackRecord = new SlackRecord(null, null, true, null, false, true, array('context.info.library', 'extra.tags.1'));
+ $data = $slackRecord->getSlackData($record);
+ $attachment = $data['attachments'][0];
+
+ $expected = array(
+ array(
+ 'title' => 'info',
+ 'value' => sprintf('```%s```', json_encode(array('author' => 'Jordi'), $this->jsonPrettyPrintFlag)),
+ 'short' => false
+ ),
+ array(
+ 'title' => 'tags',
+ 'value' => sprintf('```%s```', json_encode(array('web'))),
+ 'short' => false
+ ),
+ );
+
+ foreach ($expected as $field) {
+ $this->assertNotFalse(array_search($field, $attachment['fields']));
+ break;
+ }
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php
new file mode 100644
index 0000000..b12b01f
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php
@@ -0,0 +1,155 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+use Monolog\Formatter\LineFormatter;
+use Monolog\Handler\Slack\SlackRecord;
+
+/**
+ * @author Greg Kedzierski
+ * @see https://api.slack.com/
+ */
+class SlackHandlerTest extends TestCase
+{
+ /**
+ * @var resource
+ */
+ private $res;
+
+ /**
+ * @var SlackHandler
+ */
+ private $handler;
+
+ public function setUp()
+ {
+ if (!extension_loaded('openssl')) {
+ $this->markTestSkipped('This test requires openssl to run');
+ }
+ }
+
+ public function testWriteHeader()
+ {
+ $this->createHandler();
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/POST \/api\/chat.postMessage HTTP\/1.1\\r\\nHost: slack.com\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
+ }
+
+ public function testWriteContent()
+ {
+ $this->createHandler();
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegExp('/username=Monolog/', $content);
+ $this->assertRegExp('/channel=channel1/', $content);
+ $this->assertRegExp('/token=myToken/', $content);
+ $this->assertRegExp('/attachments/', $content);
+ }
+
+ public function testWriteContentUsesFormatterIfProvided()
+ {
+ $this->createHandler('myToken', 'channel1', 'Monolog', false);
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->createHandler('myToken', 'channel1', 'Monolog', false);
+ $this->handler->setFormatter(new LineFormatter('foo--%message%'));
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test2'));
+ fseek($this->res, 0);
+ $content2 = fread($this->res, 1024);
+
+ $this->assertRegexp('/text=test1/', $content);
+ $this->assertRegexp('/text=foo--test2/', $content2);
+ }
+
+ public function testWriteContentWithEmoji()
+ {
+ $this->createHandler('myToken', 'channel1', 'Monolog', true, 'alien');
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/icon_emoji=%3Aalien%3A/', $content);
+ }
+
+ /**
+ * @dataProvider provideLevelColors
+ */
+ public function testWriteContentWithColors($level, $expectedColor)
+ {
+ $this->createHandler();
+ $this->handler->handle($this->getRecord($level, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/%22color%22%3A%22'.$expectedColor.'/', $content);
+ }
+
+ public function testWriteContentWithPlainTextMessage()
+ {
+ $this->createHandler('myToken', 'channel1', 'Monolog', false);
+ $this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
+ fseek($this->res, 0);
+ $content = fread($this->res, 1024);
+
+ $this->assertRegexp('/text=test1/', $content);
+ }
+
+ public function provideLevelColors()
+ {
+ return array(
+ array(Logger::DEBUG, urlencode(SlackRecord::COLOR_DEFAULT)),
+ array(Logger::INFO, SlackRecord::COLOR_GOOD),
+ array(Logger::NOTICE, SlackRecord::COLOR_GOOD),
+ array(Logger::WARNING, SlackRecord::COLOR_WARNING),
+ array(Logger::ERROR, SlackRecord::COLOR_DANGER),
+ array(Logger::CRITICAL, SlackRecord::COLOR_DANGER),
+ array(Logger::ALERT, SlackRecord::COLOR_DANGER),
+ array(Logger::EMERGENCY,SlackRecord::COLOR_DANGER),
+ );
+ }
+
+ private function createHandler($token = 'myToken', $channel = 'channel1', $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeExtra = false)
+ {
+ $constructorArgs = array($token, $channel, $username, $useAttachment, $iconEmoji, Logger::DEBUG, true, $useShortAttachment, $includeExtra);
+ $this->res = fopen('php://memory', 'a');
+ $this->handler = $this->getMock(
+ '\Monolog\Handler\SlackHandler',
+ array('fsockopen', 'streamSetTimeout', 'closeSocket'),
+ $constructorArgs
+ );
+
+ $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+ $reflectionProperty->setAccessible(true);
+ $reflectionProperty->setValue($this->handler, 'localhost:1234');
+
+ $this->handler->expects($this->any())
+ ->method('fsockopen')
+ ->will($this->returnValue($this->res));
+ $this->handler->expects($this->any())
+ ->method('streamSetTimeout')
+ ->will($this->returnValue(true));
+ $this->handler->expects($this->any())
+ ->method('closeSocket')
+ ->will($this->returnValue(true));
+
+ $this->handler->setFormatter($this->getIdentityFormatter());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php
new file mode 100644
index 0000000..c9229e2
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php
@@ -0,0 +1,107 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+use Monolog\Formatter\LineFormatter;
+use Monolog\Handler\Slack\SlackRecord;
+
+/**
+ * @author Haralan Dobrev
+ * @see https://api.slack.com/incoming-webhooks
+ * @coversDefaultClass Monolog\Handler\SlackWebhookHandler
+ */
+class SlackWebhookHandlerTest extends TestCase
+{
+ const WEBHOOK_URL = 'https://hooks.slack.com/services/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E';
+
+ /**
+ * @covers ::__construct
+ * @covers ::getSlackRecord
+ */
+ public function testConstructorMinimal()
+ {
+ $handler = new SlackWebhookHandler(self::WEBHOOK_URL);
+ $record = $this->getRecord();
+ $slackRecord = $handler->getSlackRecord();
+ $this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord);
+ $this->assertEquals(array(
+ 'attachments' => array(
+ array(
+ 'fallback' => 'test',
+ 'text' => 'test',
+ 'color' => SlackRecord::COLOR_WARNING,
+ 'fields' => array(
+ array(
+ 'title' => 'Level',
+ 'value' => 'WARNING',
+ 'short' => false,
+ ),
+ ),
+ 'title' => 'Message',
+ 'mrkdwn_in' => array('fields'),
+ 'ts' => $record['datetime']->getTimestamp(),
+ ),
+ ),
+ ), $slackRecord->getSlackData($record));
+ }
+
+ /**
+ * @covers ::__construct
+ * @covers ::getSlackRecord
+ */
+ public function testConstructorFull()
+ {
+ $handler = new SlackWebhookHandler(
+ self::WEBHOOK_URL,
+ 'test-channel',
+ 'test-username',
+ false,
+ ':ghost:',
+ false,
+ false,
+ Logger::DEBUG,
+ false
+ );
+
+ $slackRecord = $handler->getSlackRecord();
+ $this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord);
+ $this->assertEquals(array(
+ 'username' => 'test-username',
+ 'text' => 'test',
+ 'channel' => 'test-channel',
+ 'icon_emoji' => ':ghost:',
+ ), $slackRecord->getSlackData($this->getRecord()));
+ }
+
+ /**
+ * @covers ::getFormatter
+ */
+ public function testGetFormatter()
+ {
+ $handler = new SlackWebhookHandler(self::WEBHOOK_URL);
+ $formatter = $handler->getFormatter();
+ $this->assertInstanceOf('Monolog\Formatter\FormatterInterface', $formatter);
+ }
+
+ /**
+ * @covers ::setFormatter
+ */
+ public function testSetFormatter()
+ {
+ $handler = new SlackWebhookHandler(self::WEBHOOK_URL);
+ $formatter = new LineFormatter();
+ $handler->setFormatter($formatter);
+ $this->assertSame($formatter, $handler->getFormatter());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php
new file mode 100644
index 0000000..b1b02bd
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php
@@ -0,0 +1,47 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+/**
+ * @author Haralan Dobrev
+ * @see https://slack.com/apps/A0F81R8ET-slackbot
+ * @coversDefaultClass Monolog\Handler\SlackbotHandler
+ */
+class SlackbotHandlerTest extends TestCase
+{
+ /**
+ * @covers ::__construct
+ */
+ public function testConstructorMinimal()
+ {
+ $handler = new SlackbotHandler('test-team', 'test-token', 'test-channel');
+ $this->assertInstanceOf('Monolog\Handler\AbstractProcessingHandler', $handler);
+ }
+
+ /**
+ * @covers ::__construct
+ */
+ public function testConstructorFull()
+ {
+ $handler = new SlackbotHandler(
+ 'test-team',
+ 'test-token',
+ 'test-channel',
+ Logger::DEBUG,
+ false
+ );
+ $this->assertInstanceOf('Monolog\Handler\AbstractProcessingHandler', $handler);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php
new file mode 100644
index 0000000..1f9c1f2
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php
@@ -0,0 +1,309 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+/**
+ * @author Pablo de Leon Belloc
+ */
+class SocketHandlerTest extends TestCase
+{
+ /**
+ * @var Monolog\Handler\SocketHandler
+ */
+ private $handler;
+
+ /**
+ * @var resource
+ */
+ private $res;
+
+ /**
+ * @expectedException UnexpectedValueException
+ */
+ public function testInvalidHostname()
+ {
+ $this->createHandler('garbage://here');
+ $this->writeRecord('data');
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testBadConnectionTimeout()
+ {
+ $this->createHandler('localhost:1234');
+ $this->handler->setConnectionTimeout(-1);
+ }
+
+ public function testSetConnectionTimeout()
+ {
+ $this->createHandler('localhost:1234');
+ $this->handler->setConnectionTimeout(10.1);
+ $this->assertEquals(10.1, $this->handler->getConnectionTimeout());
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testBadTimeout()
+ {
+ $this->createHandler('localhost:1234');
+ $this->handler->setTimeout(-1);
+ }
+
+ public function testSetTimeout()
+ {
+ $this->createHandler('localhost:1234');
+ $this->handler->setTimeout(10.25);
+ $this->assertEquals(10.25, $this->handler->getTimeout());
+ }
+
+ public function testSetWritingTimeout()
+ {
+ $this->createHandler('localhost:1234');
+ $this->handler->setWritingTimeout(10.25);
+ $this->assertEquals(10.25, $this->handler->getWritingTimeout());
+ }
+
+ public function testSetConnectionString()
+ {
+ $this->createHandler('tcp://localhost:9090');
+ $this->assertEquals('tcp://localhost:9090', $this->handler->getConnectionString());
+ }
+
+ /**
+ * @expectedException UnexpectedValueException
+ */
+ public function testExceptionIsThrownOnFsockopenError()
+ {
+ $this->setMockHandler(array('fsockopen'));
+ $this->handler->expects($this->once())
+ ->method('fsockopen')
+ ->will($this->returnValue(false));
+ $this->writeRecord('Hello world');
+ }
+
+ /**
+ * @expectedException UnexpectedValueException
+ */
+ public function testExceptionIsThrownOnPfsockopenError()
+ {
+ $this->setMockHandler(array('pfsockopen'));
+ $this->handler->expects($this->once())
+ ->method('pfsockopen')
+ ->will($this->returnValue(false));
+ $this->handler->setPersistent(true);
+ $this->writeRecord('Hello world');
+ }
+
+ /**
+ * @expectedException UnexpectedValueException
+ */
+ public function testExceptionIsThrownIfCannotSetTimeout()
+ {
+ $this->setMockHandler(array('streamSetTimeout'));
+ $this->handler->expects($this->once())
+ ->method('streamSetTimeout')
+ ->will($this->returnValue(false));
+ $this->writeRecord('Hello world');
+ }
+
+ /**
+ * @expectedException RuntimeException
+ */
+ public function testWriteFailsOnIfFwriteReturnsFalse()
+ {
+ $this->setMockHandler(array('fwrite'));
+
+ $callback = function ($arg) {
+ $map = array(
+ 'Hello world' => 6,
+ 'world' => false,
+ );
+
+ return $map[$arg];
+ };
+
+ $this->handler->expects($this->exactly(2))
+ ->method('fwrite')
+ ->will($this->returnCallback($callback));
+
+ $this->writeRecord('Hello world');
+ }
+
+ /**
+ * @expectedException RuntimeException
+ */
+ public function testWriteFailsIfStreamTimesOut()
+ {
+ $this->setMockHandler(array('fwrite', 'streamGetMetadata'));
+
+ $callback = function ($arg) {
+ $map = array(
+ 'Hello world' => 6,
+ 'world' => 5,
+ );
+
+ return $map[$arg];
+ };
+
+ $this->handler->expects($this->exactly(1))
+ ->method('fwrite')
+ ->will($this->returnCallback($callback));
+ $this->handler->expects($this->exactly(1))
+ ->method('streamGetMetadata')
+ ->will($this->returnValue(array('timed_out' => true)));
+
+ $this->writeRecord('Hello world');
+ }
+
+ /**
+ * @expectedException RuntimeException
+ */
+ public function testWriteFailsOnIncompleteWrite()
+ {
+ $this->setMockHandler(array('fwrite', 'streamGetMetadata'));
+
+ $res = $this->res;
+ $callback = function ($string) use ($res) {
+ fclose($res);
+
+ return strlen('Hello');
+ };
+
+ $this->handler->expects($this->exactly(1))
+ ->method('fwrite')
+ ->will($this->returnCallback($callback));
+ $this->handler->expects($this->exactly(1))
+ ->method('streamGetMetadata')
+ ->will($this->returnValue(array('timed_out' => false)));
+
+ $this->writeRecord('Hello world');
+ }
+
+ public function testWriteWithMemoryFile()
+ {
+ $this->setMockHandler();
+ $this->writeRecord('test1');
+ $this->writeRecord('test2');
+ $this->writeRecord('test3');
+ fseek($this->res, 0);
+ $this->assertEquals('test1test2test3', fread($this->res, 1024));
+ }
+
+ public function testWriteWithMock()
+ {
+ $this->setMockHandler(array('fwrite'));
+
+ $callback = function ($arg) {
+ $map = array(
+ 'Hello world' => 6,
+ 'world' => 5,
+ );
+
+ return $map[$arg];
+ };
+
+ $this->handler->expects($this->exactly(2))
+ ->method('fwrite')
+ ->will($this->returnCallback($callback));
+
+ $this->writeRecord('Hello world');
+ }
+
+ public function testClose()
+ {
+ $this->setMockHandler();
+ $this->writeRecord('Hello world');
+ $this->assertInternalType('resource', $this->res);
+ $this->handler->close();
+ $this->assertFalse(is_resource($this->res), "Expected resource to be closed after closing handler");
+ }
+
+ public function testCloseDoesNotClosePersistentSocket()
+ {
+ $this->setMockHandler();
+ $this->handler->setPersistent(true);
+ $this->writeRecord('Hello world');
+ $this->assertTrue(is_resource($this->res));
+ $this->handler->close();
+ $this->assertTrue(is_resource($this->res));
+ }
+
+ /**
+ * @expectedException \RuntimeException
+ */
+ public function testAvoidInfiniteLoopWhenNoDataIsWrittenForAWritingTimeoutSeconds()
+ {
+ $this->setMockHandler(array('fwrite', 'streamGetMetadata'));
+
+ $this->handler->expects($this->any())
+ ->method('fwrite')
+ ->will($this->returnValue(0));
+
+ $this->handler->expects($this->any())
+ ->method('streamGetMetadata')
+ ->will($this->returnValue(array('timed_out' => false)));
+
+ $this->handler->setWritingTimeout(1);
+
+ $this->writeRecord('Hello world');
+ }
+
+ private function createHandler($connectionString)
+ {
+ $this->handler = new SocketHandler($connectionString);
+ $this->handler->setFormatter($this->getIdentityFormatter());
+ }
+
+ private function writeRecord($string)
+ {
+ $this->handler->handle($this->getRecord(Logger::WARNING, $string));
+ }
+
+ private function setMockHandler(array $methods = array())
+ {
+ $this->res = fopen('php://memory', 'a');
+
+ $defaultMethods = array('fsockopen', 'pfsockopen', 'streamSetTimeout');
+ $newMethods = array_diff($methods, $defaultMethods);
+
+ $finalMethods = array_merge($defaultMethods, $newMethods);
+
+ $this->handler = $this->getMock(
+ '\Monolog\Handler\SocketHandler', $finalMethods, array('localhost:1234')
+ );
+
+ if (!in_array('fsockopen', $methods)) {
+ $this->handler->expects($this->any())
+ ->method('fsockopen')
+ ->will($this->returnValue($this->res));
+ }
+
+ if (!in_array('pfsockopen', $methods)) {
+ $this->handler->expects($this->any())
+ ->method('pfsockopen')
+ ->will($this->returnValue($this->res));
+ }
+
+ if (!in_array('streamSetTimeout', $methods)) {
+ $this->handler->expects($this->any())
+ ->method('streamSetTimeout')
+ ->will($this->returnValue(true));
+ }
+
+ $this->handler->setFormatter($this->getIdentityFormatter());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php
new file mode 100644
index 0000000..487030f
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php
@@ -0,0 +1,184 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+class StreamHandlerTest extends TestCase
+{
+ /**
+ * @covers Monolog\Handler\StreamHandler::__construct
+ * @covers Monolog\Handler\StreamHandler::write
+ */
+ public function testWrite()
+ {
+ $handle = fopen('php://memory', 'a+');
+ $handler = new StreamHandler($handle);
+ $handler->setFormatter($this->getIdentityFormatter());
+ $handler->handle($this->getRecord(Logger::WARNING, 'test'));
+ $handler->handle($this->getRecord(Logger::WARNING, 'test2'));
+ $handler->handle($this->getRecord(Logger::WARNING, 'test3'));
+ fseek($handle, 0);
+ $this->assertEquals('testtest2test3', fread($handle, 100));
+ }
+
+ /**
+ * @covers Monolog\Handler\StreamHandler::close
+ */
+ public function testCloseKeepsExternalHandlersOpen()
+ {
+ $handle = fopen('php://memory', 'a+');
+ $handler = new StreamHandler($handle);
+ $this->assertTrue(is_resource($handle));
+ $handler->close();
+ $this->assertTrue(is_resource($handle));
+ }
+
+ /**
+ * @covers Monolog\Handler\StreamHandler::close
+ */
+ public function testClose()
+ {
+ $handler = new StreamHandler('php://memory');
+ $handler->handle($this->getRecord(Logger::WARNING, 'test'));
+ $streamProp = new \ReflectionProperty('Monolog\Handler\StreamHandler', 'stream');
+ $streamProp->setAccessible(true);
+ $handle = $streamProp->getValue($handler);
+
+ $this->assertTrue(is_resource($handle));
+ $handler->close();
+ $this->assertFalse(is_resource($handle));
+ }
+
+ /**
+ * @covers Monolog\Handler\StreamHandler::write
+ */
+ public function testWriteCreatesTheStreamResource()
+ {
+ $handler = new StreamHandler('php://memory');
+ $handler->handle($this->getRecord());
+ }
+
+ /**
+ * @covers Monolog\Handler\StreamHandler::__construct
+ * @covers Monolog\Handler\StreamHandler::write
+ */
+ public function testWriteLocking()
+ {
+ $temp = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'monolog_locked_log';
+ $handler = new StreamHandler($temp, Logger::DEBUG, true, null, true);
+ $handler->handle($this->getRecord());
+ }
+
+ /**
+ * @expectedException LogicException
+ * @covers Monolog\Handler\StreamHandler::__construct
+ * @covers Monolog\Handler\StreamHandler::write
+ */
+ public function testWriteMissingResource()
+ {
+ $handler = new StreamHandler(null);
+ $handler->handle($this->getRecord());
+ }
+
+ public function invalidArgumentProvider()
+ {
+ return array(
+ array(1),
+ array(array()),
+ array(array('bogus://url')),
+ );
+ }
+
+ /**
+ * @dataProvider invalidArgumentProvider
+ * @expectedException InvalidArgumentException
+ * @covers Monolog\Handler\StreamHandler::__construct
+ */
+ public function testWriteInvalidArgument($invalidArgument)
+ {
+ $handler = new StreamHandler($invalidArgument);
+ }
+
+ /**
+ * @expectedException UnexpectedValueException
+ * @covers Monolog\Handler\StreamHandler::__construct
+ * @covers Monolog\Handler\StreamHandler::write
+ */
+ public function testWriteInvalidResource()
+ {
+ $handler = new StreamHandler('bogus://url');
+ $handler->handle($this->getRecord());
+ }
+
+ /**
+ * @expectedException UnexpectedValueException
+ * @covers Monolog\Handler\StreamHandler::__construct
+ * @covers Monolog\Handler\StreamHandler::write
+ */
+ public function testWriteNonExistingResource()
+ {
+ $handler = new StreamHandler('ftp://foo/bar/baz/'.rand(0, 10000));
+ $handler->handle($this->getRecord());
+ }
+
+ /**
+ * @covers Monolog\Handler\StreamHandler::__construct
+ * @covers Monolog\Handler\StreamHandler::write
+ */
+ public function testWriteNonExistingPath()
+ {
+ $handler = new StreamHandler(sys_get_temp_dir().'/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000));
+ $handler->handle($this->getRecord());
+ }
+
+ /**
+ * @covers Monolog\Handler\StreamHandler::__construct
+ * @covers Monolog\Handler\StreamHandler::write
+ */
+ public function testWriteNonExistingFileResource()
+ {
+ $handler = new StreamHandler('file://'.sys_get_temp_dir().'/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000));
+ $handler->handle($this->getRecord());
+ }
+
+ /**
+ * @expectedException Exception
+ * @expectedExceptionMessageRegExp /There is no existing directory at/
+ * @covers Monolog\Handler\StreamHandler::__construct
+ * @covers Monolog\Handler\StreamHandler::write
+ */
+ public function testWriteNonExistingAndNotCreatablePath()
+ {
+ if (defined('PHP_WINDOWS_VERSION_BUILD')) {
+ $this->markTestSkipped('Permissions checks can not run on windows');
+ }
+ $handler = new StreamHandler('/foo/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000));
+ $handler->handle($this->getRecord());
+ }
+
+ /**
+ * @expectedException Exception
+ * @expectedExceptionMessageRegExp /There is no existing directory at/
+ * @covers Monolog\Handler\StreamHandler::__construct
+ * @covers Monolog\Handler\StreamHandler::write
+ */
+ public function testWriteNonExistingAndNotCreatableFileResource()
+ {
+ if (defined('PHP_WINDOWS_VERSION_BUILD')) {
+ $this->markTestSkipped('Permissions checks can not run on windows');
+ }
+ $handler = new StreamHandler('file:///foo/bar/'.rand(0, 10000).DIRECTORY_SEPARATOR.rand(0, 10000));
+ $handler->handle($this->getRecord());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php
new file mode 100644
index 0000000..1d62940
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php
@@ -0,0 +1,113 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+use Monolog\TestCase;
+
+class SwiftMailerHandlerTest extends TestCase
+{
+ /** @var \Swift_Mailer|\PHPUnit_Framework_MockObject_MockObject */
+ private $mailer;
+
+ public function setUp()
+ {
+ $this->mailer = $this
+ ->getMockBuilder('Swift_Mailer')
+ ->disableOriginalConstructor()
+ ->getMock();
+ }
+
+ public function testMessageCreationIsLazyWhenUsingCallback()
+ {
+ $this->mailer->expects($this->never())
+ ->method('send');
+
+ $callback = function () {
+ throw new \RuntimeException('Swift_Message creation callback should not have been called in this test');
+ };
+ $handler = new SwiftMailerHandler($this->mailer, $callback);
+
+ $records = array(
+ $this->getRecord(Logger::DEBUG),
+ $this->getRecord(Logger::INFO),
+ );
+ $handler->handleBatch($records);
+ }
+
+ public function testMessageCanBeCustomizedGivenLoggedData()
+ {
+ // Wire Mailer to expect a specific Swift_Message with a customized Subject
+ $expectedMessage = new \Swift_Message();
+ $this->mailer->expects($this->once())
+ ->method('send')
+ ->with($this->callback(function ($value) use ($expectedMessage) {
+ return $value instanceof \Swift_Message
+ && $value->getSubject() === 'Emergency'
+ && $value === $expectedMessage;
+ }));
+
+ // Callback dynamically changes subject based on number of logged records
+ $callback = function ($content, array $records) use ($expectedMessage) {
+ $subject = count($records) > 0 ? 'Emergency' : 'Normal';
+ $expectedMessage->setSubject($subject);
+
+ return $expectedMessage;
+ };
+ $handler = new SwiftMailerHandler($this->mailer, $callback);
+
+ // Logging 1 record makes this an Emergency
+ $records = array(
+ $this->getRecord(Logger::EMERGENCY),
+ );
+ $handler->handleBatch($records);
+ }
+
+ public function testMessageSubjectFormatting()
+ {
+ // Wire Mailer to expect a specific Swift_Message with a customized Subject
+ $messageTemplate = new \Swift_Message();
+ $messageTemplate->setSubject('Alert: %level_name% %message%');
+ $receivedMessage = null;
+
+ $this->mailer->expects($this->once())
+ ->method('send')
+ ->with($this->callback(function ($value) use (&$receivedMessage) {
+ $receivedMessage = $value;
+ return true;
+ }));
+
+ $handler = new SwiftMailerHandler($this->mailer, $messageTemplate);
+
+ $records = array(
+ $this->getRecord(Logger::EMERGENCY),
+ );
+ $handler->handleBatch($records);
+
+ $this->assertEquals('Alert: EMERGENCY test', $receivedMessage->getSubject());
+ }
+
+ public function testMessageHaveUniqueId()
+ {
+ $messageTemplate = new \Swift_Message();
+ $handler = new SwiftMailerHandler($this->mailer, $messageTemplate);
+
+ $method = new \ReflectionMethod('Monolog\Handler\SwiftMailerHandler', 'buildMessage');
+ $method->setAccessible(true);
+ $method->invokeArgs($handler, array($messageTemplate, array()));
+
+ $builtMessage1 = $method->invoke($handler, $messageTemplate, array());
+ $builtMessage2 = $method->invoke($handler, $messageTemplate, array());
+
+ $this->assertFalse($builtMessage1->getId() === $builtMessage2->getId(), 'Two different messages have the same id');
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php
new file mode 100644
index 0000000..8f9e46b
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/SyslogHandlerTest.php
@@ -0,0 +1,44 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\Logger;
+
+class SyslogHandlerTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @covers Monolog\Handler\SyslogHandler::__construct
+ */
+ public function testConstruct()
+ {
+ $handler = new SyslogHandler('test');
+ $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler);
+
+ $handler = new SyslogHandler('test', LOG_USER);
+ $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler);
+
+ $handler = new SyslogHandler('test', 'user');
+ $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler);
+
+ $handler = new SyslogHandler('test', LOG_USER, Logger::DEBUG, true, LOG_PERROR);
+ $this->assertInstanceOf('Monolog\Handler\SyslogHandler', $handler);
+ }
+
+ /**
+ * @covers Monolog\Handler\SyslogHandler::__construct
+ */
+ public function testConstructInvalidFacility()
+ {
+ $this->setExpectedException('UnexpectedValueException');
+ $handler = new SyslogHandler('test', 'unknown');
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php
new file mode 100644
index 0000000..7ee8a98
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php
@@ -0,0 +1,76 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+
+/**
+ * @requires extension sockets
+ */
+class SyslogUdpHandlerTest extends TestCase
+{
+ /**
+ * @expectedException UnexpectedValueException
+ */
+ public function testWeValidateFacilities()
+ {
+ $handler = new SyslogUdpHandler("ip", null, "invalidFacility");
+ }
+
+ public function testWeSplitIntoLines()
+ {
+ $time = '2014-01-07T12:34';
+ $pid = getmypid();
+ $host = gethostname();
+
+ $handler = $this->getMockBuilder('\Monolog\Handler\SyslogUdpHandler')
+ ->setConstructorArgs(array("127.0.0.1", 514, "authpriv"))
+ ->setMethods(array('getDateTime'))
+ ->getMock();
+
+ $handler->method('getDateTime')
+ ->willReturn($time);
+
+ $handler->setFormatter(new \Monolog\Formatter\ChromePHPFormatter());
+
+ $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol'));
+ $socket->expects($this->at(0))
+ ->method('write')
+ ->with("lol", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - ");
+ $socket->expects($this->at(1))
+ ->method('write')
+ ->with("hej", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - ");
+
+ $handler->setSocket($socket);
+
+ $handler->handle($this->getRecordWithMessage("hej\nlol"));
+ }
+
+ public function testSplitWorksOnEmptyMsg()
+ {
+ $handler = new SyslogUdpHandler("127.0.0.1", 514, "authpriv");
+ $handler->setFormatter($this->getIdentityFormatter());
+
+ $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol'));
+ $socket->expects($this->never())
+ ->method('write');
+
+ $handler->setSocket($socket);
+
+ $handler->handle($this->getRecordWithMessage(null));
+ }
+
+ protected function getRecordWithMessage($msg)
+ {
+ return array('message' => $msg, 'level' => \Monolog\Logger::WARNING, 'context' => null, 'extra' => array(), 'channel' => 'lol');
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php
new file mode 100644
index 0000000..bfb8d3d
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php
@@ -0,0 +1,70 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+/**
+ * @covers Monolog\Handler\TestHandler
+ */
+class TestHandlerTest extends TestCase
+{
+ /**
+ * @dataProvider methodProvider
+ */
+ public function testHandler($method, $level)
+ {
+ $handler = new TestHandler;
+ $record = $this->getRecord($level, 'test'.$method);
+ $this->assertFalse($handler->hasRecords($level));
+ $this->assertFalse($handler->hasRecord($record, $level));
+ $this->assertFalse($handler->{'has'.$method}($record), 'has'.$method);
+ $this->assertFalse($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains');
+ $this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function ($rec) {
+ return true;
+ }), 'has'.$method.'ThatPasses');
+ $this->assertFalse($handler->{'has'.$method.'ThatMatches'}('/test\w+/'));
+ $this->assertFalse($handler->{'has'.$method.'Records'}(), 'has'.$method.'Records');
+ $handler->handle($record);
+
+ $this->assertFalse($handler->{'has'.$method}('bar'), 'has'.$method);
+ $this->assertTrue($handler->hasRecords($level));
+ $this->assertTrue($handler->hasRecord($record, $level));
+ $this->assertTrue($handler->{'has'.$method}($record), 'has'.$method);
+ $this->assertTrue($handler->{'has'.$method}('test'.$method), 'has'.$method);
+ $this->assertTrue($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains');
+ $this->assertTrue($handler->{'has'.$method.'ThatPasses'}(function ($rec) {
+ return true;
+ }), 'has'.$method.'ThatPasses');
+ $this->assertTrue($handler->{'has'.$method.'ThatMatches'}('/test\w+/'));
+ $this->assertTrue($handler->{'has'.$method.'Records'}(), 'has'.$method.'Records');
+
+ $records = $handler->getRecords();
+ unset($records[0]['formatted']);
+ $this->assertEquals(array($record), $records);
+ }
+
+ public function methodProvider()
+ {
+ return array(
+ array('Emergency', Logger::EMERGENCY),
+ array('Alert' , Logger::ALERT),
+ array('Critical' , Logger::CRITICAL),
+ array('Error' , Logger::ERROR),
+ array('Warning' , Logger::WARNING),
+ array('Info' , Logger::INFO),
+ array('Notice' , Logger::NOTICE),
+ array('Debug' , Logger::DEBUG),
+ );
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php
new file mode 100644
index 0000000..fa524d0
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/UdpSocketTest.php
@@ -0,0 +1,64 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Handler\SyslogUdp\UdpSocket;
+
+/**
+ * @requires extension sockets
+ */
+class UdpSocketTest extends TestCase
+{
+ public function testWeDoNotTruncateShortMessages()
+ {
+ $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol'));
+
+ $socket->expects($this->at(0))
+ ->method('send')
+ ->with("HEADER: The quick brown fox jumps over the lazy dog");
+
+ $socket->write("The quick brown fox jumps over the lazy dog", "HEADER: ");
+ }
+
+ public function testLongMessagesAreTruncated()
+ {
+ $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol'));
+
+ $truncatedString = str_repeat("derp", 16254).'d';
+
+ $socket->expects($this->exactly(1))
+ ->method('send')
+ ->with("HEADER" . $truncatedString);
+
+ $longString = str_repeat("derp", 20000);
+
+ $socket->write($longString, "HEADER");
+ }
+
+ public function testDoubleCloseDoesNotError()
+ {
+ $socket = new UdpSocket('127.0.0.1', 514);
+ $socket->close();
+ $socket->close();
+ }
+
+ /**
+ * @expectedException LogicException
+ */
+ public function testWriteAfterCloseErrors()
+ {
+ $socket = new UdpSocket('127.0.0.1', 514);
+ $socket->close();
+ $socket->write('foo', "HEADER");
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php
new file mode 100644
index 0000000..8d37a1f
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/WhatFailureGroupHandlerTest.php
@@ -0,0 +1,121 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+use Monolog\Logger;
+
+class WhatFailureGroupHandlerTest extends TestCase
+{
+ /**
+ * @covers Monolog\Handler\WhatFailureGroupHandler::__construct
+ * @expectedException InvalidArgumentException
+ */
+ public function testConstructorOnlyTakesHandler()
+ {
+ new WhatFailureGroupHandler(array(new TestHandler(), "foo"));
+ }
+
+ /**
+ * @covers Monolog\Handler\WhatFailureGroupHandler::__construct
+ * @covers Monolog\Handler\WhatFailureGroupHandler::handle
+ */
+ public function testHandle()
+ {
+ $testHandlers = array(new TestHandler(), new TestHandler());
+ $handler = new WhatFailureGroupHandler($testHandlers);
+ $handler->handle($this->getRecord(Logger::DEBUG));
+ $handler->handle($this->getRecord(Logger::INFO));
+ foreach ($testHandlers as $test) {
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertTrue(count($test->getRecords()) === 2);
+ }
+ }
+
+ /**
+ * @covers Monolog\Handler\WhatFailureGroupHandler::handleBatch
+ */
+ public function testHandleBatch()
+ {
+ $testHandlers = array(new TestHandler(), new TestHandler());
+ $handler = new WhatFailureGroupHandler($testHandlers);
+ $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO)));
+ foreach ($testHandlers as $test) {
+ $this->assertTrue($test->hasDebugRecords());
+ $this->assertTrue($test->hasInfoRecords());
+ $this->assertTrue(count($test->getRecords()) === 2);
+ }
+ }
+
+ /**
+ * @covers Monolog\Handler\WhatFailureGroupHandler::isHandling
+ */
+ public function testIsHandling()
+ {
+ $testHandlers = array(new TestHandler(Logger::ERROR), new TestHandler(Logger::WARNING));
+ $handler = new WhatFailureGroupHandler($testHandlers);
+ $this->assertTrue($handler->isHandling($this->getRecord(Logger::ERROR)));
+ $this->assertTrue($handler->isHandling($this->getRecord(Logger::WARNING)));
+ $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG)));
+ }
+
+ /**
+ * @covers Monolog\Handler\WhatFailureGroupHandler::handle
+ */
+ public function testHandleUsesProcessors()
+ {
+ $test = new TestHandler();
+ $handler = new WhatFailureGroupHandler(array($test));
+ $handler->pushProcessor(function ($record) {
+ $record['extra']['foo'] = true;
+
+ return $record;
+ });
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertTrue($test->hasWarningRecords());
+ $records = $test->getRecords();
+ $this->assertTrue($records[0]['extra']['foo']);
+ }
+
+ /**
+ * @covers Monolog\Handler\WhatFailureGroupHandler::handle
+ */
+ public function testHandleException()
+ {
+ $test = new TestHandler();
+ $exception = new ExceptionTestHandler();
+ $handler = new WhatFailureGroupHandler(array($exception, $test, $exception));
+ $handler->pushProcessor(function ($record) {
+ $record['extra']['foo'] = true;
+
+ return $record;
+ });
+ $handler->handle($this->getRecord(Logger::WARNING));
+ $this->assertTrue($test->hasWarningRecords());
+ $records = $test->getRecords();
+ $this->assertTrue($records[0]['extra']['foo']);
+ }
+}
+
+class ExceptionTestHandler extends TestHandler
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function handle(array $record)
+ {
+ parent::handle($record);
+
+ throw new \Exception("ExceptionTestHandler::handle");
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php b/vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php
new file mode 100644
index 0000000..69b001e
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php
@@ -0,0 +1,69 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Handler;
+
+use Monolog\TestCase;
+
+class ZendMonitorHandlerTest extends TestCase
+{
+ protected $zendMonitorHandler;
+
+ public function setUp()
+ {
+ if (!function_exists('zend_monitor_custom_event')) {
+ $this->markTestSkipped('ZendServer is not installed');
+ }
+ }
+
+ /**
+ * @covers Monolog\Handler\ZendMonitorHandler::write
+ */
+ public function testWrite()
+ {
+ $record = $this->getRecord();
+ $formatterResult = array(
+ 'message' => $record['message'],
+ );
+
+ $zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler')
+ ->setMethods(array('writeZendMonitorCustomEvent', 'getDefaultFormatter'))
+ ->getMock();
+
+ $formatterMock = $this->getMockBuilder('Monolog\Formatter\NormalizerFormatter')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $formatterMock->expects($this->once())
+ ->method('format')
+ ->will($this->returnValue($formatterResult));
+
+ $zendMonitor->expects($this->once())
+ ->method('getDefaultFormatter')
+ ->will($this->returnValue($formatterMock));
+
+ $levelMap = $zendMonitor->getLevelMap();
+
+ $zendMonitor->expects($this->once())
+ ->method('writeZendMonitorCustomEvent')
+ ->with($levelMap[$record['level']], $record['message'], $formatterResult);
+
+ $zendMonitor->handle($record);
+ }
+
+ /**
+ * @covers Monolog\Handler\ZendMonitorHandler::getDefaultFormatter
+ */
+ public function testGetDefaultFormatterReturnsNormalizerFormatter()
+ {
+ $zendMonitor = new ZendMonitorHandler();
+ $this->assertInstanceOf('Monolog\Formatter\NormalizerFormatter', $zendMonitor->getDefaultFormatter());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/LoggerTest.php b/vendor/monolog/monolog/tests/Monolog/LoggerTest.php
new file mode 100644
index 0000000..1ecc34a
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/LoggerTest.php
@@ -0,0 +1,548 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog;
+
+use Monolog\Processor\WebProcessor;
+use Monolog\Handler\TestHandler;
+
+class LoggerTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @covers Monolog\Logger::getName
+ */
+ public function testGetName()
+ {
+ $logger = new Logger('foo');
+ $this->assertEquals('foo', $logger->getName());
+ }
+
+ /**
+ * @covers Monolog\Logger::getLevelName
+ */
+ public function testGetLevelName()
+ {
+ $this->assertEquals('ERROR', Logger::getLevelName(Logger::ERROR));
+ }
+
+ /**
+ * @covers Monolog\Logger::withName
+ */
+ public function testWithName()
+ {
+ $first = new Logger('first', array($handler = new TestHandler()));
+ $second = $first->withName('second');
+
+ $this->assertSame('first', $first->getName());
+ $this->assertSame('second', $second->getName());
+ $this->assertSame($handler, $second->popHandler());
+ }
+
+ /**
+ * @covers Monolog\Logger::toMonologLevel
+ */
+ public function testConvertPSR3ToMonologLevel()
+ {
+ $this->assertEquals(Logger::toMonologLevel('debug'), 100);
+ $this->assertEquals(Logger::toMonologLevel('info'), 200);
+ $this->assertEquals(Logger::toMonologLevel('notice'), 250);
+ $this->assertEquals(Logger::toMonologLevel('warning'), 300);
+ $this->assertEquals(Logger::toMonologLevel('error'), 400);
+ $this->assertEquals(Logger::toMonologLevel('critical'), 500);
+ $this->assertEquals(Logger::toMonologLevel('alert'), 550);
+ $this->assertEquals(Logger::toMonologLevel('emergency'), 600);
+ }
+
+ /**
+ * @covers Monolog\Logger::getLevelName
+ * @expectedException InvalidArgumentException
+ */
+ public function testGetLevelNameThrows()
+ {
+ Logger::getLevelName(5);
+ }
+
+ /**
+ * @covers Monolog\Logger::__construct
+ */
+ public function testChannel()
+ {
+ $logger = new Logger('foo');
+ $handler = new TestHandler;
+ $logger->pushHandler($handler);
+ $logger->addWarning('test');
+ list($record) = $handler->getRecords();
+ $this->assertEquals('foo', $record['channel']);
+ }
+
+ /**
+ * @covers Monolog\Logger::addRecord
+ */
+ public function testLog()
+ {
+ $logger = new Logger(__METHOD__);
+
+ $handler = $this->getMock('Monolog\Handler\NullHandler', array('handle'));
+ $handler->expects($this->once())
+ ->method('handle');
+ $logger->pushHandler($handler);
+
+ $this->assertTrue($logger->addWarning('test'));
+ }
+
+ /**
+ * @covers Monolog\Logger::addRecord
+ */
+ public function testLogNotHandled()
+ {
+ $logger = new Logger(__METHOD__);
+
+ $handler = $this->getMock('Monolog\Handler\NullHandler', array('handle'), array(Logger::ERROR));
+ $handler->expects($this->never())
+ ->method('handle');
+ $logger->pushHandler($handler);
+
+ $this->assertFalse($logger->addWarning('test'));
+ }
+
+ public function testHandlersInCtor()
+ {
+ $handler1 = new TestHandler;
+ $handler2 = new TestHandler;
+ $logger = new Logger(__METHOD__, array($handler1, $handler2));
+
+ $this->assertEquals($handler1, $logger->popHandler());
+ $this->assertEquals($handler2, $logger->popHandler());
+ }
+
+ public function testProcessorsInCtor()
+ {
+ $processor1 = new WebProcessor;
+ $processor2 = new WebProcessor;
+ $logger = new Logger(__METHOD__, array(), array($processor1, $processor2));
+
+ $this->assertEquals($processor1, $logger->popProcessor());
+ $this->assertEquals($processor2, $logger->popProcessor());
+ }
+
+ /**
+ * @covers Monolog\Logger::pushHandler
+ * @covers Monolog\Logger::popHandler
+ * @expectedException LogicException
+ */
+ public function testPushPopHandler()
+ {
+ $logger = new Logger(__METHOD__);
+ $handler1 = new TestHandler;
+ $handler2 = new TestHandler;
+
+ $logger->pushHandler($handler1);
+ $logger->pushHandler($handler2);
+
+ $this->assertEquals($handler2, $logger->popHandler());
+ $this->assertEquals($handler1, $logger->popHandler());
+ $logger->popHandler();
+ }
+
+ /**
+ * @covers Monolog\Logger::setHandlers
+ */
+ public function testSetHandlers()
+ {
+ $logger = new Logger(__METHOD__);
+ $handler1 = new TestHandler;
+ $handler2 = new TestHandler;
+
+ $logger->pushHandler($handler1);
+ $logger->setHandlers(array($handler2));
+
+ // handler1 has been removed
+ $this->assertEquals(array($handler2), $logger->getHandlers());
+
+ $logger->setHandlers(array(
+ "AMapKey" => $handler1,
+ "Woop" => $handler2,
+ ));
+
+ // Keys have been scrubbed
+ $this->assertEquals(array($handler1, $handler2), $logger->getHandlers());
+ }
+
+ /**
+ * @covers Monolog\Logger::pushProcessor
+ * @covers Monolog\Logger::popProcessor
+ * @expectedException LogicException
+ */
+ public function testPushPopProcessor()
+ {
+ $logger = new Logger(__METHOD__);
+ $processor1 = new WebProcessor;
+ $processor2 = new WebProcessor;
+
+ $logger->pushProcessor($processor1);
+ $logger->pushProcessor($processor2);
+
+ $this->assertEquals($processor2, $logger->popProcessor());
+ $this->assertEquals($processor1, $logger->popProcessor());
+ $logger->popProcessor();
+ }
+
+ /**
+ * @covers Monolog\Logger::pushProcessor
+ * @expectedException InvalidArgumentException
+ */
+ public function testPushProcessorWithNonCallable()
+ {
+ $logger = new Logger(__METHOD__);
+
+ $logger->pushProcessor(new \stdClass());
+ }
+
+ /**
+ * @covers Monolog\Logger::addRecord
+ */
+ public function testProcessorsAreExecuted()
+ {
+ $logger = new Logger(__METHOD__);
+ $handler = new TestHandler;
+ $logger->pushHandler($handler);
+ $logger->pushProcessor(function ($record) {
+ $record['extra']['win'] = true;
+
+ return $record;
+ });
+ $logger->addError('test');
+ list($record) = $handler->getRecords();
+ $this->assertTrue($record['extra']['win']);
+ }
+
+ /**
+ * @covers Monolog\Logger::addRecord
+ */
+ public function testProcessorsAreCalledOnlyOnce()
+ {
+ $logger = new Logger(__METHOD__);
+ $handler = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler->expects($this->any())
+ ->method('isHandling')
+ ->will($this->returnValue(true))
+ ;
+ $handler->expects($this->any())
+ ->method('handle')
+ ->will($this->returnValue(true))
+ ;
+ $logger->pushHandler($handler);
+
+ $processor = $this->getMockBuilder('Monolog\Processor\WebProcessor')
+ ->disableOriginalConstructor()
+ ->setMethods(array('__invoke'))
+ ->getMock()
+ ;
+ $processor->expects($this->once())
+ ->method('__invoke')
+ ->will($this->returnArgument(0))
+ ;
+ $logger->pushProcessor($processor);
+
+ $logger->addError('test');
+ }
+
+ /**
+ * @covers Monolog\Logger::addRecord
+ */
+ public function testProcessorsNotCalledWhenNotHandled()
+ {
+ $logger = new Logger(__METHOD__);
+ $handler = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler->expects($this->once())
+ ->method('isHandling')
+ ->will($this->returnValue(false))
+ ;
+ $logger->pushHandler($handler);
+ $that = $this;
+ $logger->pushProcessor(function ($record) use ($that) {
+ $that->fail('The processor should not be called');
+ });
+ $logger->addAlert('test');
+ }
+
+ /**
+ * @covers Monolog\Logger::addRecord
+ */
+ public function testHandlersNotCalledBeforeFirstHandling()
+ {
+ $logger = new Logger(__METHOD__);
+
+ $handler1 = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler1->expects($this->never())
+ ->method('isHandling')
+ ->will($this->returnValue(false))
+ ;
+ $handler1->expects($this->once())
+ ->method('handle')
+ ->will($this->returnValue(false))
+ ;
+ $logger->pushHandler($handler1);
+
+ $handler2 = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler2->expects($this->once())
+ ->method('isHandling')
+ ->will($this->returnValue(true))
+ ;
+ $handler2->expects($this->once())
+ ->method('handle')
+ ->will($this->returnValue(false))
+ ;
+ $logger->pushHandler($handler2);
+
+ $handler3 = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler3->expects($this->once())
+ ->method('isHandling')
+ ->will($this->returnValue(false))
+ ;
+ $handler3->expects($this->never())
+ ->method('handle')
+ ;
+ $logger->pushHandler($handler3);
+
+ $logger->debug('test');
+ }
+
+ /**
+ * @covers Monolog\Logger::addRecord
+ */
+ public function testHandlersNotCalledBeforeFirstHandlingWithAssocArray()
+ {
+ $handler1 = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler1->expects($this->never())
+ ->method('isHandling')
+ ->will($this->returnValue(false))
+ ;
+ $handler1->expects($this->once())
+ ->method('handle')
+ ->will($this->returnValue(false))
+ ;
+
+ $handler2 = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler2->expects($this->once())
+ ->method('isHandling')
+ ->will($this->returnValue(true))
+ ;
+ $handler2->expects($this->once())
+ ->method('handle')
+ ->will($this->returnValue(false))
+ ;
+
+ $handler3 = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler3->expects($this->once())
+ ->method('isHandling')
+ ->will($this->returnValue(false))
+ ;
+ $handler3->expects($this->never())
+ ->method('handle')
+ ;
+
+ $logger = new Logger(__METHOD__, array('last' => $handler3, 'second' => $handler2, 'first' => $handler1));
+
+ $logger->debug('test');
+ }
+
+ /**
+ * @covers Monolog\Logger::addRecord
+ */
+ public function testBubblingWhenTheHandlerReturnsFalse()
+ {
+ $logger = new Logger(__METHOD__);
+
+ $handler1 = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler1->expects($this->any())
+ ->method('isHandling')
+ ->will($this->returnValue(true))
+ ;
+ $handler1->expects($this->once())
+ ->method('handle')
+ ->will($this->returnValue(false))
+ ;
+ $logger->pushHandler($handler1);
+
+ $handler2 = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler2->expects($this->any())
+ ->method('isHandling')
+ ->will($this->returnValue(true))
+ ;
+ $handler2->expects($this->once())
+ ->method('handle')
+ ->will($this->returnValue(false))
+ ;
+ $logger->pushHandler($handler2);
+
+ $logger->debug('test');
+ }
+
+ /**
+ * @covers Monolog\Logger::addRecord
+ */
+ public function testNotBubblingWhenTheHandlerReturnsTrue()
+ {
+ $logger = new Logger(__METHOD__);
+
+ $handler1 = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler1->expects($this->any())
+ ->method('isHandling')
+ ->will($this->returnValue(true))
+ ;
+ $handler1->expects($this->never())
+ ->method('handle')
+ ;
+ $logger->pushHandler($handler1);
+
+ $handler2 = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler2->expects($this->any())
+ ->method('isHandling')
+ ->will($this->returnValue(true))
+ ;
+ $handler2->expects($this->once())
+ ->method('handle')
+ ->will($this->returnValue(true))
+ ;
+ $logger->pushHandler($handler2);
+
+ $logger->debug('test');
+ }
+
+ /**
+ * @covers Monolog\Logger::isHandling
+ */
+ public function testIsHandling()
+ {
+ $logger = new Logger(__METHOD__);
+
+ $handler1 = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler1->expects($this->any())
+ ->method('isHandling')
+ ->will($this->returnValue(false))
+ ;
+
+ $logger->pushHandler($handler1);
+ $this->assertFalse($logger->isHandling(Logger::DEBUG));
+
+ $handler2 = $this->getMock('Monolog\Handler\HandlerInterface');
+ $handler2->expects($this->any())
+ ->method('isHandling')
+ ->will($this->returnValue(true))
+ ;
+
+ $logger->pushHandler($handler2);
+ $this->assertTrue($logger->isHandling(Logger::DEBUG));
+ }
+
+ /**
+ * @dataProvider logMethodProvider
+ * @covers Monolog\Logger::addDebug
+ * @covers Monolog\Logger::addInfo
+ * @covers Monolog\Logger::addNotice
+ * @covers Monolog\Logger::addWarning
+ * @covers Monolog\Logger::addError
+ * @covers Monolog\Logger::addCritical
+ * @covers Monolog\Logger::addAlert
+ * @covers Monolog\Logger::addEmergency
+ * @covers Monolog\Logger::debug
+ * @covers Monolog\Logger::info
+ * @covers Monolog\Logger::notice
+ * @covers Monolog\Logger::warn
+ * @covers Monolog\Logger::err
+ * @covers Monolog\Logger::crit
+ * @covers Monolog\Logger::alert
+ * @covers Monolog\Logger::emerg
+ */
+ public function testLogMethods($method, $expectedLevel)
+ {
+ $logger = new Logger('foo');
+ $handler = new TestHandler;
+ $logger->pushHandler($handler);
+ $logger->{$method}('test');
+ list($record) = $handler->getRecords();
+ $this->assertEquals($expectedLevel, $record['level']);
+ }
+
+ public function logMethodProvider()
+ {
+ return array(
+ // monolog methods
+ array('addDebug', Logger::DEBUG),
+ array('addInfo', Logger::INFO),
+ array('addNotice', Logger::NOTICE),
+ array('addWarning', Logger::WARNING),
+ array('addError', Logger::ERROR),
+ array('addCritical', Logger::CRITICAL),
+ array('addAlert', Logger::ALERT),
+ array('addEmergency', Logger::EMERGENCY),
+
+ // ZF/Sf2 compat methods
+ array('debug', Logger::DEBUG),
+ array('info', Logger::INFO),
+ array('notice', Logger::NOTICE),
+ array('warn', Logger::WARNING),
+ array('err', Logger::ERROR),
+ array('crit', Logger::CRITICAL),
+ array('alert', Logger::ALERT),
+ array('emerg', Logger::EMERGENCY),
+ );
+ }
+
+ /**
+ * @dataProvider setTimezoneProvider
+ * @covers Monolog\Logger::setTimezone
+ */
+ public function testSetTimezone($tz)
+ {
+ Logger::setTimezone($tz);
+ $logger = new Logger('foo');
+ $handler = new TestHandler;
+ $logger->pushHandler($handler);
+ $logger->info('test');
+ list($record) = $handler->getRecords();
+ $this->assertEquals($tz, $record['datetime']->getTimezone());
+ }
+
+ public function setTimezoneProvider()
+ {
+ return array_map(
+ function ($tz) { return array(new \DateTimeZone($tz)); },
+ \DateTimeZone::listIdentifiers()
+ );
+ }
+
+ /**
+ * @dataProvider useMicrosecondTimestampsProvider
+ * @covers Monolog\Logger::useMicrosecondTimestamps
+ * @covers Monolog\Logger::addRecord
+ */
+ public function testUseMicrosecondTimestamps($micro, $assert)
+ {
+ $logger = new Logger('foo');
+ $logger->useMicrosecondTimestamps($micro);
+ $handler = new TestHandler;
+ $logger->pushHandler($handler);
+ $logger->info('test');
+ list($record) = $handler->getRecords();
+ $this->{$assert}('000000', $record['datetime']->format('u'));
+ }
+
+ public function useMicrosecondTimestampsProvider()
+ {
+ return array(
+ // this has a very small chance of a false negative (1/10^6)
+ 'with microseconds' => array(true, 'assertNotSame'),
+ 'without microseconds' => array(false, PHP_VERSION_ID >= 70100 ? 'assertNotSame' : 'assertSame'),
+ );
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php
new file mode 100644
index 0000000..5adb505
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php
@@ -0,0 +1,29 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+use Monolog\TestCase;
+
+class GitProcessorTest extends TestCase
+{
+ /**
+ * @covers Monolog\Processor\GitProcessor::__invoke
+ */
+ public function testProcessor()
+ {
+ $processor = new GitProcessor();
+ $record = $processor($this->getRecord());
+
+ $this->assertArrayHasKey('git', $record['extra']);
+ $this->assertTrue(!is_array($record['extra']['git']['branch']));
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php
new file mode 100644
index 0000000..0dd411d
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php
@@ -0,0 +1,123 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Acme;
+
+class Tester
+{
+ public function test($handler, $record)
+ {
+ $handler->handle($record);
+ }
+}
+
+function tester($handler, $record)
+{
+ $handler->handle($record);
+}
+
+namespace Monolog\Processor;
+
+use Monolog\Logger;
+use Monolog\TestCase;
+use Monolog\Handler\TestHandler;
+
+class IntrospectionProcessorTest extends TestCase
+{
+ public function getHandler()
+ {
+ $processor = new IntrospectionProcessor();
+ $handler = new TestHandler();
+ $handler->pushProcessor($processor);
+
+ return $handler;
+ }
+
+ public function testProcessorFromClass()
+ {
+ $handler = $this->getHandler();
+ $tester = new \Acme\Tester;
+ $tester->test($handler, $this->getRecord());
+ list($record) = $handler->getRecords();
+ $this->assertEquals(__FILE__, $record['extra']['file']);
+ $this->assertEquals(18, $record['extra']['line']);
+ $this->assertEquals('Acme\Tester', $record['extra']['class']);
+ $this->assertEquals('test', $record['extra']['function']);
+ }
+
+ public function testProcessorFromFunc()
+ {
+ $handler = $this->getHandler();
+ \Acme\tester($handler, $this->getRecord());
+ list($record) = $handler->getRecords();
+ $this->assertEquals(__FILE__, $record['extra']['file']);
+ $this->assertEquals(24, $record['extra']['line']);
+ $this->assertEquals(null, $record['extra']['class']);
+ $this->assertEquals('Acme\tester', $record['extra']['function']);
+ }
+
+ public function testLevelTooLow()
+ {
+ $input = array(
+ 'level' => Logger::DEBUG,
+ 'extra' => array(),
+ );
+
+ $expected = $input;
+
+ $processor = new IntrospectionProcessor(Logger::CRITICAL);
+ $actual = $processor($input);
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testLevelEqual()
+ {
+ $input = array(
+ 'level' => Logger::CRITICAL,
+ 'extra' => array(),
+ );
+
+ $expected = $input;
+ $expected['extra'] = array(
+ 'file' => null,
+ 'line' => null,
+ 'class' => 'ReflectionMethod',
+ 'function' => 'invokeArgs',
+ );
+
+ $processor = new IntrospectionProcessor(Logger::CRITICAL);
+ $actual = $processor($input);
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function testLevelHigher()
+ {
+ $input = array(
+ 'level' => Logger::EMERGENCY,
+ 'extra' => array(),
+ );
+
+ $expected = $input;
+ $expected['extra'] = array(
+ 'file' => null,
+ 'line' => null,
+ 'class' => 'ReflectionMethod',
+ 'function' => 'invokeArgs',
+ );
+
+ $processor = new IntrospectionProcessor(Logger::CRITICAL);
+ $actual = $processor($input);
+
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php
new file mode 100644
index 0000000..eb66614
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Processor/MemoryPeakUsageProcessorTest.php
@@ -0,0 +1,42 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+use Monolog\TestCase;
+
+class MemoryPeakUsageProcessorTest extends TestCase
+{
+ /**
+ * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke
+ * @covers Monolog\Processor\MemoryProcessor::formatBytes
+ */
+ public function testProcessor()
+ {
+ $processor = new MemoryPeakUsageProcessor();
+ $record = $processor($this->getRecord());
+ $this->assertArrayHasKey('memory_peak_usage', $record['extra']);
+ $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_peak_usage']);
+ }
+
+ /**
+ * @covers Monolog\Processor\MemoryPeakUsageProcessor::__invoke
+ * @covers Monolog\Processor\MemoryProcessor::formatBytes
+ */
+ public function testProcessorWithoutFormatting()
+ {
+ $processor = new MemoryPeakUsageProcessor(true, false);
+ $record = $processor($this->getRecord());
+ $this->assertArrayHasKey('memory_peak_usage', $record['extra']);
+ $this->assertInternalType('int', $record['extra']['memory_peak_usage']);
+ $this->assertGreaterThan(0, $record['extra']['memory_peak_usage']);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php
new file mode 100644
index 0000000..4692dbf
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Processor/MemoryUsageProcessorTest.php
@@ -0,0 +1,42 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+use Monolog\TestCase;
+
+class MemoryUsageProcessorTest extends TestCase
+{
+ /**
+ * @covers Monolog\Processor\MemoryUsageProcessor::__invoke
+ * @covers Monolog\Processor\MemoryProcessor::formatBytes
+ */
+ public function testProcessor()
+ {
+ $processor = new MemoryUsageProcessor();
+ $record = $processor($this->getRecord());
+ $this->assertArrayHasKey('memory_usage', $record['extra']);
+ $this->assertRegExp('#[0-9.]+ (M|K)?B$#', $record['extra']['memory_usage']);
+ }
+
+ /**
+ * @covers Monolog\Processor\MemoryUsageProcessor::__invoke
+ * @covers Monolog\Processor\MemoryProcessor::formatBytes
+ */
+ public function testProcessorWithoutFormatting()
+ {
+ $processor = new MemoryUsageProcessor(true, false);
+ $record = $processor($this->getRecord());
+ $this->assertArrayHasKey('memory_usage', $record['extra']);
+ $this->assertInternalType('int', $record['extra']['memory_usage']);
+ $this->assertGreaterThan(0, $record['extra']['memory_usage']);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php
new file mode 100644
index 0000000..11f2b35
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php
@@ -0,0 +1,41 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+use Monolog\TestCase;
+
+class MercurialProcessorTest extends TestCase
+{
+ /**
+ * @covers Monolog\Processor\MercurialProcessor::__invoke
+ */
+ public function testProcessor()
+ {
+ if (defined('PHP_WINDOWS_VERSION_BUILD')) {
+ exec("where hg 2>NUL", $output, $result);
+ } else {
+ exec("which hg 2>/dev/null >/dev/null", $output, $result);
+ }
+ if ($result != 0) {
+ $this->markTestSkipped('hg is missing');
+ return;
+ }
+
+ `hg init`;
+ $processor = new MercurialProcessor();
+ $record = $processor($this->getRecord());
+
+ $this->assertArrayHasKey('hg', $record['extra']);
+ $this->assertTrue(!is_array($record['extra']['hg']['branch']));
+ $this->assertTrue(!is_array($record['extra']['hg']['revision']));
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php
new file mode 100644
index 0000000..458d2a3
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Processor/ProcessIdProcessorTest.php
@@ -0,0 +1,30 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+use Monolog\TestCase;
+
+class ProcessIdProcessorTest extends TestCase
+{
+ /**
+ * @covers Monolog\Processor\ProcessIdProcessor::__invoke
+ */
+ public function testProcessor()
+ {
+ $processor = new ProcessIdProcessor();
+ $record = $processor($this->getRecord());
+ $this->assertArrayHasKey('process_id', $record['extra']);
+ $this->assertInternalType('int', $record['extra']['process_id']);
+ $this->assertGreaterThan(0, $record['extra']['process_id']);
+ $this->assertEquals(getmypid(), $record['extra']['process_id']);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php
new file mode 100644
index 0000000..029a0c0
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php
@@ -0,0 +1,43 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+class PsrLogMessageProcessorTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @dataProvider getPairs
+ */
+ public function testReplacement($val, $expected)
+ {
+ $proc = new PsrLogMessageProcessor;
+
+ $message = $proc(array(
+ 'message' => '{foo}',
+ 'context' => array('foo' => $val),
+ ));
+ $this->assertEquals($expected, $message['message']);
+ }
+
+ public function getPairs()
+ {
+ return array(
+ array('foo', 'foo'),
+ array('3', '3'),
+ array(3, '3'),
+ array(null, ''),
+ array(true, '1'),
+ array(false, ''),
+ array(new \stdClass, '[object stdClass]'),
+ array(array(), '[array]'),
+ );
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php
new file mode 100644
index 0000000..0d860c6
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Processor/TagProcessorTest.php
@@ -0,0 +1,49 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+use Monolog\TestCase;
+
+class TagProcessorTest extends TestCase
+{
+ /**
+ * @covers Monolog\Processor\TagProcessor::__invoke
+ */
+ public function testProcessor()
+ {
+ $tags = array(1, 2, 3);
+ $processor = new TagProcessor($tags);
+ $record = $processor($this->getRecord());
+
+ $this->assertEquals($tags, $record['extra']['tags']);
+ }
+
+ /**
+ * @covers Monolog\Processor\TagProcessor::__invoke
+ */
+ public function testProcessorTagModification()
+ {
+ $tags = array(1, 2, 3);
+ $processor = new TagProcessor($tags);
+
+ $record = $processor($this->getRecord());
+ $this->assertEquals($tags, $record['extra']['tags']);
+
+ $processor->setTags(array('a', 'b'));
+ $record = $processor($this->getRecord());
+ $this->assertEquals(array('a', 'b'), $record['extra']['tags']);
+
+ $processor->addTags(array('a', 'c', 'foo' => 'bar'));
+ $record = $processor($this->getRecord());
+ $this->assertEquals(array('a', 'b', 'a', 'c', 'foo' => 'bar'), $record['extra']['tags']);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php
new file mode 100644
index 0000000..5d13058
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php
@@ -0,0 +1,33 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+use Monolog\TestCase;
+
+class UidProcessorTest extends TestCase
+{
+ /**
+ * @covers Monolog\Processor\UidProcessor::__invoke
+ */
+ public function testProcessor()
+ {
+ $processor = new UidProcessor();
+ $record = $processor($this->getRecord());
+ $this->assertArrayHasKey('uid', $record['extra']);
+ }
+
+ public function testGetUid()
+ {
+ $processor = new UidProcessor(10);
+ $this->assertEquals(10, strlen($processor->getUid()));
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php b/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php
new file mode 100644
index 0000000..4105baf
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php
@@ -0,0 +1,113 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog\Processor;
+
+use Monolog\TestCase;
+
+class WebProcessorTest extends TestCase
+{
+ public function testProcessor()
+ {
+ $server = array(
+ 'REQUEST_URI' => 'A',
+ 'REMOTE_ADDR' => 'B',
+ 'REQUEST_METHOD' => 'C',
+ 'HTTP_REFERER' => 'D',
+ 'SERVER_NAME' => 'F',
+ 'UNIQUE_ID' => 'G',
+ );
+
+ $processor = new WebProcessor($server);
+ $record = $processor($this->getRecord());
+ $this->assertEquals($server['REQUEST_URI'], $record['extra']['url']);
+ $this->assertEquals($server['REMOTE_ADDR'], $record['extra']['ip']);
+ $this->assertEquals($server['REQUEST_METHOD'], $record['extra']['http_method']);
+ $this->assertEquals($server['HTTP_REFERER'], $record['extra']['referrer']);
+ $this->assertEquals($server['SERVER_NAME'], $record['extra']['server']);
+ $this->assertEquals($server['UNIQUE_ID'], $record['extra']['unique_id']);
+ }
+
+ public function testProcessorDoNothingIfNoRequestUri()
+ {
+ $server = array(
+ 'REMOTE_ADDR' => 'B',
+ 'REQUEST_METHOD' => 'C',
+ );
+ $processor = new WebProcessor($server);
+ $record = $processor($this->getRecord());
+ $this->assertEmpty($record['extra']);
+ }
+
+ public function testProcessorReturnNullIfNoHttpReferer()
+ {
+ $server = array(
+ 'REQUEST_URI' => 'A',
+ 'REMOTE_ADDR' => 'B',
+ 'REQUEST_METHOD' => 'C',
+ 'SERVER_NAME' => 'F',
+ );
+ $processor = new WebProcessor($server);
+ $record = $processor($this->getRecord());
+ $this->assertNull($record['extra']['referrer']);
+ }
+
+ public function testProcessorDoesNotAddUniqueIdIfNotPresent()
+ {
+ $server = array(
+ 'REQUEST_URI' => 'A',
+ 'REMOTE_ADDR' => 'B',
+ 'REQUEST_METHOD' => 'C',
+ 'SERVER_NAME' => 'F',
+ );
+ $processor = new WebProcessor($server);
+ $record = $processor($this->getRecord());
+ $this->assertFalse(isset($record['extra']['unique_id']));
+ }
+
+ public function testProcessorAddsOnlyRequestedExtraFields()
+ {
+ $server = array(
+ 'REQUEST_URI' => 'A',
+ 'REMOTE_ADDR' => 'B',
+ 'REQUEST_METHOD' => 'C',
+ 'SERVER_NAME' => 'F',
+ );
+
+ $processor = new WebProcessor($server, array('url', 'http_method'));
+ $record = $processor($this->getRecord());
+
+ $this->assertSame(array('url' => 'A', 'http_method' => 'C'), $record['extra']);
+ }
+
+ public function testProcessorConfiguringOfExtraFields()
+ {
+ $server = array(
+ 'REQUEST_URI' => 'A',
+ 'REMOTE_ADDR' => 'B',
+ 'REQUEST_METHOD' => 'C',
+ 'SERVER_NAME' => 'F',
+ );
+
+ $processor = new WebProcessor($server, array('url' => 'REMOTE_ADDR'));
+ $record = $processor($this->getRecord());
+
+ $this->assertSame(array('url' => 'B'), $record['extra']);
+ }
+
+ /**
+ * @expectedException UnexpectedValueException
+ */
+ public function testInvalidData()
+ {
+ new WebProcessor(new \stdClass);
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php b/vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php
new file mode 100644
index 0000000..ab89944
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/PsrLogCompatTest.php
@@ -0,0 +1,47 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog;
+
+use Monolog\Handler\TestHandler;
+use Monolog\Formatter\LineFormatter;
+use Monolog\Processor\PsrLogMessageProcessor;
+use Psr\Log\Test\LoggerInterfaceTest;
+
+class PsrLogCompatTest extends LoggerInterfaceTest
+{
+ private $handler;
+
+ public function getLogger()
+ {
+ $logger = new Logger('foo');
+ $logger->pushHandler($handler = new TestHandler);
+ $logger->pushProcessor(new PsrLogMessageProcessor);
+ $handler->setFormatter(new LineFormatter('%level_name% %message%'));
+
+ $this->handler = $handler;
+
+ return $logger;
+ }
+
+ public function getLogs()
+ {
+ $convert = function ($record) {
+ $lower = function ($match) {
+ return strtolower($match[0]);
+ };
+
+ return preg_replace_callback('{^[A-Z]+}', $lower, $record['formatted']);
+ };
+
+ return array_map($convert, $this->handler->getRecords());
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/RegistryTest.php b/vendor/monolog/monolog/tests/Monolog/RegistryTest.php
new file mode 100644
index 0000000..15fdfbd
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/RegistryTest.php
@@ -0,0 +1,153 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog;
+
+class RegistryTest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ Registry::clear();
+ }
+
+ /**
+ * @dataProvider hasLoggerProvider
+ * @covers Monolog\Registry::hasLogger
+ */
+ public function testHasLogger(array $loggersToAdd, array $loggersToCheck, array $expectedResult)
+ {
+ foreach ($loggersToAdd as $loggerToAdd) {
+ Registry::addLogger($loggerToAdd);
+ }
+ foreach ($loggersToCheck as $index => $loggerToCheck) {
+ $this->assertSame($expectedResult[$index], Registry::hasLogger($loggerToCheck));
+ }
+ }
+
+ public function hasLoggerProvider()
+ {
+ $logger1 = new Logger('test1');
+ $logger2 = new Logger('test2');
+ $logger3 = new Logger('test3');
+
+ return array(
+ // only instances
+ array(
+ array($logger1),
+ array($logger1, $logger2),
+ array(true, false),
+ ),
+ // only names
+ array(
+ array($logger1),
+ array('test1', 'test2'),
+ array(true, false),
+ ),
+ // mixed case
+ array(
+ array($logger1, $logger2),
+ array('test1', $logger2, 'test3', $logger3),
+ array(true, true, false, false),
+ ),
+ );
+ }
+
+ /**
+ * @covers Monolog\Registry::clear
+ */
+ public function testClearClears()
+ {
+ Registry::addLogger(new Logger('test1'), 'log');
+ Registry::clear();
+
+ $this->setExpectedException('\InvalidArgumentException');
+ Registry::getInstance('log');
+ }
+
+ /**
+ * @dataProvider removedLoggerProvider
+ * @covers Monolog\Registry::addLogger
+ * @covers Monolog\Registry::removeLogger
+ */
+ public function testRemovesLogger($loggerToAdd, $remove)
+ {
+ Registry::addLogger($loggerToAdd);
+ Registry::removeLogger($remove);
+
+ $this->setExpectedException('\InvalidArgumentException');
+ Registry::getInstance($loggerToAdd->getName());
+ }
+
+ public function removedLoggerProvider()
+ {
+ $logger1 = new Logger('test1');
+
+ return array(
+ array($logger1, $logger1),
+ array($logger1, 'test1'),
+ );
+ }
+
+ /**
+ * @covers Monolog\Registry::addLogger
+ * @covers Monolog\Registry::getInstance
+ * @covers Monolog\Registry::__callStatic
+ */
+ public function testGetsSameLogger()
+ {
+ $logger1 = new Logger('test1');
+ $logger2 = new Logger('test2');
+
+ Registry::addLogger($logger1, 'test1');
+ Registry::addLogger($logger2);
+
+ $this->assertSame($logger1, Registry::getInstance('test1'));
+ $this->assertSame($logger2, Registry::test2());
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @covers Monolog\Registry::getInstance
+ */
+ public function testFailsOnNonExistantLogger()
+ {
+ Registry::getInstance('test1');
+ }
+
+ /**
+ * @covers Monolog\Registry::addLogger
+ */
+ public function testReplacesLogger()
+ {
+ $log1 = new Logger('test1');
+ $log2 = new Logger('test2');
+
+ Registry::addLogger($log1, 'log');
+
+ Registry::addLogger($log2, 'log', true);
+
+ $this->assertSame($log2, Registry::getInstance('log'));
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @covers Monolog\Registry::addLogger
+ */
+ public function testFailsOnUnspecifiedReplacement()
+ {
+ $log1 = new Logger('test1');
+ $log2 = new Logger('test2');
+
+ Registry::addLogger($log1, 'log');
+
+ Registry::addLogger($log2, 'log');
+ }
+}
diff --git a/vendor/monolog/monolog/tests/Monolog/TestCase.php b/vendor/monolog/monolog/tests/Monolog/TestCase.php
new file mode 100644
index 0000000..4eb7b4c
--- /dev/null
+++ b/vendor/monolog/monolog/tests/Monolog/TestCase.php
@@ -0,0 +1,58 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Monolog;
+
+class TestCase extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @return array Record
+ */
+ protected function getRecord($level = Logger::WARNING, $message = 'test', $context = array())
+ {
+ return array(
+ 'message' => $message,
+ 'context' => $context,
+ 'level' => $level,
+ 'level_name' => Logger::getLevelName($level),
+ 'channel' => 'test',
+ 'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true))),
+ 'extra' => array(),
+ );
+ }
+
+ /**
+ * @return array
+ */
+ protected function getMultipleRecords()
+ {
+ return array(
+ $this->getRecord(Logger::DEBUG, 'debug message 1'),
+ $this->getRecord(Logger::DEBUG, 'debug message 2'),
+ $this->getRecord(Logger::INFO, 'information'),
+ $this->getRecord(Logger::WARNING, 'warning'),
+ $this->getRecord(Logger::ERROR, 'error'),
+ );
+ }
+
+ /**
+ * @return Monolog\Formatter\FormatterInterface
+ */
+ protected function getIdentityFormatter()
+ {
+ $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
+ $formatter->expects($this->any())
+ ->method('format')
+ ->will($this->returnCallback(function ($record) { return $record['message']; }));
+
+ return $formatter;
+ }
+}
diff --git a/vendor/psr/http-message/CHANGELOG.md b/vendor/psr/http-message/CHANGELOG.md
new file mode 100644
index 0000000..74b1ef9
--- /dev/null
+++ b/vendor/psr/http-message/CHANGELOG.md
@@ -0,0 +1,36 @@
+# Changelog
+
+All notable changes to this project will be documented in this file, in reverse chronological order by release.
+
+## 1.0.1 - 2016-08-06
+
+### Added
+
+- Nothing.
+
+### Deprecated
+
+- Nothing.
+
+### Removed
+
+- Nothing.
+
+### Fixed
+
+- Updated all `@return self` annotation references in interfaces to use
+ `@return static`, which more closelly follows the semantics of the
+ specification.
+- Updated the `MessageInterface::getHeaders()` return annotation to use the
+ value `string[][]`, indicating the format is a nested array of strings.
+- Updated the `@link` annotation for `RequestInterface::withRequestTarget()`
+ to point to the correct section of RFC 7230.
+- Updated the `ServerRequestInterface::withUploadedFiles()` parameter annotation
+ to add the parameter name (`$uploadedFiles`).
+- Updated a `@throws` annotation for the `UploadedFileInterface::moveTo()`
+ method to correctly reference the method parameter (it was referencing an
+ incorrect parameter name previously).
+
+## 1.0.0 - 2016-05-18
+
+Initial stable release; reflects accepted PSR-7 specification.
diff --git a/vendor/psr/http-message/LICENSE b/vendor/psr/http-message/LICENSE
new file mode 100644
index 0000000..c2d8e45
--- /dev/null
+++ b/vendor/psr/http-message/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2014 PHP Framework Interoperability Group
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/psr/http-message/README.md b/vendor/psr/http-message/README.md
new file mode 100644
index 0000000..2818533
--- /dev/null
+++ b/vendor/psr/http-message/README.md
@@ -0,0 +1,13 @@
+PSR Http Message
+================
+
+This repository holds all interfaces/classes/traits related to
+[PSR-7](http://www.php-fig.org/psr/psr-7/).
+
+Note that this is not a HTTP message implementation of its own. It is merely an
+interface that describes a HTTP message. See the specification for more details.
+
+Usage
+-----
+
+We'll certainly need some stuff in here.
\ No newline at end of file
diff --git a/vendor/psr/http-message/composer.json b/vendor/psr/http-message/composer.json
new file mode 100644
index 0000000..b0d2937
--- /dev/null
+++ b/vendor/psr/http-message/composer.json
@@ -0,0 +1,26 @@
+{
+ "name": "psr/http-message",
+ "description": "Common interface for HTTP messages",
+ "keywords": ["psr", "psr-7", "http", "http-message", "request", "response"],
+ "homepage": "https://github.com/php-fig/http-message",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ }
+}
diff --git a/vendor/psr/http-message/src/MessageInterface.php b/vendor/psr/http-message/src/MessageInterface.php
new file mode 100644
index 0000000..dd46e5e
--- /dev/null
+++ b/vendor/psr/http-message/src/MessageInterface.php
@@ -0,0 +1,187 @@
+getHeaders() as $name => $values) {
+ * echo $name . ": " . implode(", ", $values);
+ * }
+ *
+ * // Emit headers iteratively:
+ * foreach ($message->getHeaders() as $name => $values) {
+ * foreach ($values as $value) {
+ * header(sprintf('%s: %s', $name, $value), false);
+ * }
+ * }
+ *
+ * While header names are not case-sensitive, getHeaders() will preserve the
+ * exact case in which headers were originally specified.
+ *
+ * @return string[][] Returns an associative array of the message's headers. Each
+ * key MUST be a header name, and each value MUST be an array of strings
+ * for that header.
+ */
+ public function getHeaders();
+
+ /**
+ * Checks if a header exists by the given case-insensitive name.
+ *
+ * @param string $name Case-insensitive header field name.
+ * @return bool Returns true if any header names match the given header
+ * name using a case-insensitive string comparison. Returns false if
+ * no matching header name is found in the message.
+ */
+ public function hasHeader($name);
+
+ /**
+ * Retrieves a message header value by the given case-insensitive name.
+ *
+ * This method returns an array of all the header values of the given
+ * case-insensitive header name.
+ *
+ * If the header does not appear in the message, this method MUST return an
+ * empty array.
+ *
+ * @param string $name Case-insensitive header field name.
+ * @return string[] An array of string values as provided for the given
+ * header. If the header does not appear in the message, this method MUST
+ * return an empty array.
+ */
+ public function getHeader($name);
+
+ /**
+ * Retrieves a comma-separated string of the values for a single header.
+ *
+ * This method returns all of the header values of the given
+ * case-insensitive header name as a string concatenated together using
+ * a comma.
+ *
+ * NOTE: Not all header values may be appropriately represented using
+ * comma concatenation. For such headers, use getHeader() instead
+ * and supply your own delimiter when concatenating.
+ *
+ * If the header does not appear in the message, this method MUST return
+ * an empty string.
+ *
+ * @param string $name Case-insensitive header field name.
+ * @return string A string of values as provided for the given header
+ * concatenated together using a comma. If the header does not appear in
+ * the message, this method MUST return an empty string.
+ */
+ public function getHeaderLine($name);
+
+ /**
+ * Return an instance with the provided value replacing the specified header.
+ *
+ * While header names are case-insensitive, the casing of the header will
+ * be preserved by this function, and returned from getHeaders().
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * new and/or updated header and value.
+ *
+ * @param string $name Case-insensitive header field name.
+ * @param string|string[] $value Header value(s).
+ * @return static
+ * @throws \InvalidArgumentException for invalid header names or values.
+ */
+ public function withHeader($name, $value);
+
+ /**
+ * Return an instance with the specified header appended with the given value.
+ *
+ * Existing values for the specified header will be maintained. The new
+ * value(s) will be appended to the existing list. If the header did not
+ * exist previously, it will be added.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * new header and/or value.
+ *
+ * @param string $name Case-insensitive header field name to add.
+ * @param string|string[] $value Header value(s).
+ * @return static
+ * @throws \InvalidArgumentException for invalid header names or values.
+ */
+ public function withAddedHeader($name, $value);
+
+ /**
+ * Return an instance without the specified header.
+ *
+ * Header resolution MUST be done without case-sensitivity.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that removes
+ * the named header.
+ *
+ * @param string $name Case-insensitive header field name to remove.
+ * @return static
+ */
+ public function withoutHeader($name);
+
+ /**
+ * Gets the body of the message.
+ *
+ * @return StreamInterface Returns the body as a stream.
+ */
+ public function getBody();
+
+ /**
+ * Return an instance with the specified message body.
+ *
+ * The body MUST be a StreamInterface object.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return a new instance that has the
+ * new body stream.
+ *
+ * @param StreamInterface $body Body.
+ * @return static
+ * @throws \InvalidArgumentException When the body is not valid.
+ */
+ public function withBody(StreamInterface $body);
+}
diff --git a/vendor/psr/http-message/src/RequestInterface.php b/vendor/psr/http-message/src/RequestInterface.php
new file mode 100644
index 0000000..a96d4fd
--- /dev/null
+++ b/vendor/psr/http-message/src/RequestInterface.php
@@ -0,0 +1,129 @@
+getQuery()`
+ * or from the `QUERY_STRING` server param.
+ *
+ * @return array
+ */
+ public function getQueryParams();
+
+ /**
+ * Return an instance with the specified query string arguments.
+ *
+ * These values SHOULD remain immutable over the course of the incoming
+ * request. They MAY be injected during instantiation, such as from PHP's
+ * $_GET superglobal, or MAY be derived from some other value such as the
+ * URI. In cases where the arguments are parsed from the URI, the data
+ * MUST be compatible with what PHP's parse_str() would return for
+ * purposes of how duplicate query parameters are handled, and how nested
+ * sets are handled.
+ *
+ * Setting query string arguments MUST NOT change the URI stored by the
+ * request, nor the values in the server params.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * updated query string arguments.
+ *
+ * @param array $query Array of query string arguments, typically from
+ * $_GET.
+ * @return static
+ */
+ public function withQueryParams(array $query);
+
+ /**
+ * Retrieve normalized file upload data.
+ *
+ * This method returns upload metadata in a normalized tree, with each leaf
+ * an instance of Psr\Http\Message\UploadedFileInterface.
+ *
+ * These values MAY be prepared from $_FILES or the message body during
+ * instantiation, or MAY be injected via withUploadedFiles().
+ *
+ * @return array An array tree of UploadedFileInterface instances; an empty
+ * array MUST be returned if no data is present.
+ */
+ public function getUploadedFiles();
+
+ /**
+ * Create a new instance with the specified uploaded files.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * updated body parameters.
+ *
+ * @param array $uploadedFiles An array tree of UploadedFileInterface instances.
+ * @return static
+ * @throws \InvalidArgumentException if an invalid structure is provided.
+ */
+ public function withUploadedFiles(array $uploadedFiles);
+
+ /**
+ * Retrieve any parameters provided in the request body.
+ *
+ * If the request Content-Type is either application/x-www-form-urlencoded
+ * or multipart/form-data, and the request method is POST, this method MUST
+ * return the contents of $_POST.
+ *
+ * Otherwise, this method may return any results of deserializing
+ * the request body content; as parsing returns structured content, the
+ * potential types MUST be arrays or objects only. A null value indicates
+ * the absence of body content.
+ *
+ * @return null|array|object The deserialized body parameters, if any.
+ * These will typically be an array or object.
+ */
+ public function getParsedBody();
+
+ /**
+ * Return an instance with the specified body parameters.
+ *
+ * These MAY be injected during instantiation.
+ *
+ * If the request Content-Type is either application/x-www-form-urlencoded
+ * or multipart/form-data, and the request method is POST, use this method
+ * ONLY to inject the contents of $_POST.
+ *
+ * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of
+ * deserializing the request body content. Deserialization/parsing returns
+ * structured data, and, as such, this method ONLY accepts arrays or objects,
+ * or a null value if nothing was available to parse.
+ *
+ * As an example, if content negotiation determines that the request data
+ * is a JSON payload, this method could be used to create a request
+ * instance with the deserialized parameters.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * updated body parameters.
+ *
+ * @param null|array|object $data The deserialized body data. This will
+ * typically be in an array or object.
+ * @return static
+ * @throws \InvalidArgumentException if an unsupported argument type is
+ * provided.
+ */
+ public function withParsedBody($data);
+
+ /**
+ * Retrieve attributes derived from the request.
+ *
+ * The request "attributes" may be used to allow injection of any
+ * parameters derived from the request: e.g., the results of path
+ * match operations; the results of decrypting cookies; the results of
+ * deserializing non-form-encoded message bodies; etc. Attributes
+ * will be application and request specific, and CAN be mutable.
+ *
+ * @return array Attributes derived from the request.
+ */
+ public function getAttributes();
+
+ /**
+ * Retrieve a single derived request attribute.
+ *
+ * Retrieves a single derived request attribute as described in
+ * getAttributes(). If the attribute has not been previously set, returns
+ * the default value as provided.
+ *
+ * This method obviates the need for a hasAttribute() method, as it allows
+ * specifying a default value to return if the attribute is not found.
+ *
+ * @see getAttributes()
+ * @param string $name The attribute name.
+ * @param mixed $default Default value to return if the attribute does not exist.
+ * @return mixed
+ */
+ public function getAttribute($name, $default = null);
+
+ /**
+ * Return an instance with the specified derived request attribute.
+ *
+ * This method allows setting a single derived request attribute as
+ * described in getAttributes().
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * updated attribute.
+ *
+ * @see getAttributes()
+ * @param string $name The attribute name.
+ * @param mixed $value The value of the attribute.
+ * @return static
+ */
+ public function withAttribute($name, $value);
+
+ /**
+ * Return an instance that removes the specified derived request attribute.
+ *
+ * This method allows removing a single derived request attribute as
+ * described in getAttributes().
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that removes
+ * the attribute.
+ *
+ * @see getAttributes()
+ * @param string $name The attribute name.
+ * @return static
+ */
+ public function withoutAttribute($name);
+}
diff --git a/vendor/psr/http-message/src/StreamInterface.php b/vendor/psr/http-message/src/StreamInterface.php
new file mode 100644
index 0000000..f68f391
--- /dev/null
+++ b/vendor/psr/http-message/src/StreamInterface.php
@@ -0,0 +1,158 @@
+
+ * [user-info@]host[:port]
+ *
+ *
+ * If the port component is not set or is the standard port for the current
+ * scheme, it SHOULD NOT be included.
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-3.2
+ * @return string The URI authority, in "[user-info@]host[:port]" format.
+ */
+ public function getAuthority();
+
+ /**
+ * Retrieve the user information component of the URI.
+ *
+ * If no user information is present, this method MUST return an empty
+ * string.
+ *
+ * If a user is present in the URI, this will return that value;
+ * additionally, if the password is also present, it will be appended to the
+ * user value, with a colon (":") separating the values.
+ *
+ * The trailing "@" character is not part of the user information and MUST
+ * NOT be added.
+ *
+ * @return string The URI user information, in "username[:password]" format.
+ */
+ public function getUserInfo();
+
+ /**
+ * Retrieve the host component of the URI.
+ *
+ * If no host is present, this method MUST return an empty string.
+ *
+ * The value returned MUST be normalized to lowercase, per RFC 3986
+ * Section 3.2.2.
+ *
+ * @see http://tools.ietf.org/html/rfc3986#section-3.2.2
+ * @return string The URI host.
+ */
+ public function getHost();
+
+ /**
+ * Retrieve the port component of the URI.
+ *
+ * If a port is present, and it is non-standard for the current scheme,
+ * this method MUST return it as an integer. If the port is the standard port
+ * used with the current scheme, this method SHOULD return null.
+ *
+ * If no port is present, and no scheme is present, this method MUST return
+ * a null value.
+ *
+ * If no port is present, but a scheme is present, this method MAY return
+ * the standard port for that scheme, but SHOULD return null.
+ *
+ * @return null|int The URI port.
+ */
+ public function getPort();
+
+ /**
+ * Retrieve the path component of the URI.
+ *
+ * The path can either be empty or absolute (starting with a slash) or
+ * rootless (not starting with a slash). Implementations MUST support all
+ * three syntaxes.
+ *
+ * Normally, the empty path "" and absolute path "/" are considered equal as
+ * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically
+ * do this normalization because in contexts with a trimmed base path, e.g.
+ * the front controller, this difference becomes significant. It's the task
+ * of the user to handle both "" and "/".
+ *
+ * The value returned MUST be percent-encoded, but MUST NOT double-encode
+ * any characters. To determine what characters to encode, please refer to
+ * RFC 3986, Sections 2 and 3.3.
+ *
+ * As an example, if the value should include a slash ("/") not intended as
+ * delimiter between path segments, that value MUST be passed in encoded
+ * form (e.g., "%2F") to the instance.
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-2
+ * @see https://tools.ietf.org/html/rfc3986#section-3.3
+ * @return string The URI path.
+ */
+ public function getPath();
+
+ /**
+ * Retrieve the query string of the URI.
+ *
+ * If no query string is present, this method MUST return an empty string.
+ *
+ * The leading "?" character is not part of the query and MUST NOT be
+ * added.
+ *
+ * The value returned MUST be percent-encoded, but MUST NOT double-encode
+ * any characters. To determine what characters to encode, please refer to
+ * RFC 3986, Sections 2 and 3.4.
+ *
+ * As an example, if a value in a key/value pair of the query string should
+ * include an ampersand ("&") not intended as a delimiter between values,
+ * that value MUST be passed in encoded form (e.g., "%26") to the instance.
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-2
+ * @see https://tools.ietf.org/html/rfc3986#section-3.4
+ * @return string The URI query string.
+ */
+ public function getQuery();
+
+ /**
+ * Retrieve the fragment component of the URI.
+ *
+ * If no fragment is present, this method MUST return an empty string.
+ *
+ * The leading "#" character is not part of the fragment and MUST NOT be
+ * added.
+ *
+ * The value returned MUST be percent-encoded, but MUST NOT double-encode
+ * any characters. To determine what characters to encode, please refer to
+ * RFC 3986, Sections 2 and 3.5.
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-2
+ * @see https://tools.ietf.org/html/rfc3986#section-3.5
+ * @return string The URI fragment.
+ */
+ public function getFragment();
+
+ /**
+ * Return an instance with the specified scheme.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified scheme.
+ *
+ * Implementations MUST support the schemes "http" and "https" case
+ * insensitively, and MAY accommodate other schemes if required.
+ *
+ * An empty scheme is equivalent to removing the scheme.
+ *
+ * @param string $scheme The scheme to use with the new instance.
+ * @return static A new instance with the specified scheme.
+ * @throws \InvalidArgumentException for invalid or unsupported schemes.
+ */
+ public function withScheme($scheme);
+
+ /**
+ * Return an instance with the specified user information.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified user information.
+ *
+ * Password is optional, but the user information MUST include the
+ * user; an empty string for the user is equivalent to removing user
+ * information.
+ *
+ * @param string $user The user name to use for authority.
+ * @param null|string $password The password associated with $user.
+ * @return static A new instance with the specified user information.
+ */
+ public function withUserInfo($user, $password = null);
+
+ /**
+ * Return an instance with the specified host.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified host.
+ *
+ * An empty host value is equivalent to removing the host.
+ *
+ * @param string $host The hostname to use with the new instance.
+ * @return static A new instance with the specified host.
+ * @throws \InvalidArgumentException for invalid hostnames.
+ */
+ public function withHost($host);
+
+ /**
+ * Return an instance with the specified port.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified port.
+ *
+ * Implementations MUST raise an exception for ports outside the
+ * established TCP and UDP port ranges.
+ *
+ * A null value provided for the port is equivalent to removing the port
+ * information.
+ *
+ * @param null|int $port The port to use with the new instance; a null value
+ * removes the port information.
+ * @return static A new instance with the specified port.
+ * @throws \InvalidArgumentException for invalid ports.
+ */
+ public function withPort($port);
+
+ /**
+ * Return an instance with the specified path.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified path.
+ *
+ * The path can either be empty or absolute (starting with a slash) or
+ * rootless (not starting with a slash). Implementations MUST support all
+ * three syntaxes.
+ *
+ * If the path is intended to be domain-relative rather than path relative then
+ * it must begin with a slash ("/"). Paths not starting with a slash ("/")
+ * are assumed to be relative to some base path known to the application or
+ * consumer.
+ *
+ * Users can provide both encoded and decoded path characters.
+ * Implementations ensure the correct encoding as outlined in getPath().
+ *
+ * @param string $path The path to use with the new instance.
+ * @return static A new instance with the specified path.
+ * @throws \InvalidArgumentException for invalid paths.
+ */
+ public function withPath($path);
+
+ /**
+ * Return an instance with the specified query string.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified query string.
+ *
+ * Users can provide both encoded and decoded query characters.
+ * Implementations ensure the correct encoding as outlined in getQuery().
+ *
+ * An empty query string value is equivalent to removing the query string.
+ *
+ * @param string $query The query string to use with the new instance.
+ * @return static A new instance with the specified query string.
+ * @throws \InvalidArgumentException for invalid query strings.
+ */
+ public function withQuery($query);
+
+ /**
+ * Return an instance with the specified URI fragment.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified URI fragment.
+ *
+ * Users can provide both encoded and decoded fragment characters.
+ * Implementations ensure the correct encoding as outlined in getFragment().
+ *
+ * An empty fragment value is equivalent to removing the fragment.
+ *
+ * @param string $fragment The fragment to use with the new instance.
+ * @return static A new instance with the specified fragment.
+ */
+ public function withFragment($fragment);
+
+ /**
+ * Return the string representation as a URI reference.
+ *
+ * Depending on which components of the URI are present, the resulting
+ * string is either a full URI or relative reference according to RFC 3986,
+ * Section 4.1. The method concatenates the various components of the URI,
+ * using the appropriate delimiters:
+ *
+ * - If a scheme is present, it MUST be suffixed by ":".
+ * - If an authority is present, it MUST be prefixed by "//".
+ * - The path can be concatenated without delimiters. But there are two
+ * cases where the path has to be adjusted to make the URI reference
+ * valid as PHP does not allow to throw an exception in __toString():
+ * - If the path is rootless and an authority is present, the path MUST
+ * be prefixed by "/".
+ * - If the path is starting with more than one "/" and no authority is
+ * present, the starting slashes MUST be reduced to one.
+ * - If a query is present, it MUST be prefixed by "?".
+ * - If a fragment is present, it MUST be prefixed by "#".
+ *
+ * @see http://tools.ietf.org/html/rfc3986#section-4.1
+ * @return string
+ */
+ public function __toString();
+}
diff --git a/vendor/psr/log/Psr/Log/AbstractLogger.php b/vendor/psr/log/Psr/Log/AbstractLogger.php
index 00f9034..90e721a 100644
--- a/vendor/psr/log/Psr/Log/AbstractLogger.php
+++ b/vendor/psr/log/Psr/Log/AbstractLogger.php
@@ -15,8 +15,9 @@ abstract class AbstractLogger implements LoggerInterface
* System is unusable.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function emergency($message, array $context = array())
{
@@ -30,8 +31,9 @@ public function emergency($message, array $context = array())
* trigger the SMS alerts and wake you up.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function alert($message, array $context = array())
{
@@ -44,8 +46,9 @@ public function alert($message, array $context = array())
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function critical($message, array $context = array())
{
@@ -57,8 +60,9 @@ public function critical($message, array $context = array())
* be logged and monitored.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function error($message, array $context = array())
{
@@ -72,8 +76,9 @@ public function error($message, array $context = array())
* that are not necessarily wrong.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function warning($message, array $context = array())
{
@@ -84,8 +89,9 @@ public function warning($message, array $context = array())
* Normal but significant events.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function notice($message, array $context = array())
{
@@ -98,8 +104,9 @@ public function notice($message, array $context = array())
* Example: User logs in, SQL logs.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function info($message, array $context = array())
{
@@ -110,8 +117,9 @@ public function info($message, array $context = array())
* Detailed debug information.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function debug($message, array $context = array())
{
diff --git a/vendor/psr/log/Psr/Log/LogLevel.php b/vendor/psr/log/Psr/Log/LogLevel.php
index e32c151..9cebcac 100644
--- a/vendor/psr/log/Psr/Log/LogLevel.php
+++ b/vendor/psr/log/Psr/Log/LogLevel.php
@@ -3,16 +3,16 @@
namespace Psr\Log;
/**
- * Describes log levels
+ * Describes log levels.
*/
class LogLevel
{
const EMERGENCY = 'emergency';
- const ALERT = 'alert';
- const CRITICAL = 'critical';
- const ERROR = 'error';
- const WARNING = 'warning';
- const NOTICE = 'notice';
- const INFO = 'info';
- const DEBUG = 'debug';
+ const ALERT = 'alert';
+ const CRITICAL = 'critical';
+ const ERROR = 'error';
+ const WARNING = 'warning';
+ const NOTICE = 'notice';
+ const INFO = 'info';
+ const DEBUG = 'debug';
}
diff --git a/vendor/psr/log/Psr/Log/LoggerAwareInterface.php b/vendor/psr/log/Psr/Log/LoggerAwareInterface.php
index 2eebc4e..4d64f47 100644
--- a/vendor/psr/log/Psr/Log/LoggerAwareInterface.php
+++ b/vendor/psr/log/Psr/Log/LoggerAwareInterface.php
@@ -3,15 +3,16 @@
namespace Psr\Log;
/**
- * Describes a logger-aware instance
+ * Describes a logger-aware instance.
*/
interface LoggerAwareInterface
{
/**
- * Sets a logger instance on the object
+ * Sets a logger instance on the object.
*
* @param LoggerInterface $logger
- * @return null
+ *
+ * @return void
*/
public function setLogger(LoggerInterface $logger);
}
diff --git a/vendor/psr/log/Psr/Log/LoggerAwareTrait.php b/vendor/psr/log/Psr/Log/LoggerAwareTrait.php
index f087a3d..639f79b 100644
--- a/vendor/psr/log/Psr/Log/LoggerAwareTrait.php
+++ b/vendor/psr/log/Psr/Log/LoggerAwareTrait.php
@@ -7,12 +7,16 @@
*/
trait LoggerAwareTrait
{
- /** @var LoggerInterface */
+ /**
+ * The logger instance.
+ *
+ * @var LoggerInterface
+ */
protected $logger;
/**
* Sets a logger.
- *
+ *
* @param LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger)
diff --git a/vendor/psr/log/Psr/Log/LoggerInterface.php b/vendor/psr/log/Psr/Log/LoggerInterface.php
index 476bb96..5ea7243 100644
--- a/vendor/psr/log/Psr/Log/LoggerInterface.php
+++ b/vendor/psr/log/Psr/Log/LoggerInterface.php
@@ -3,14 +3,14 @@
namespace Psr\Log;
/**
- * Describes a logger instance
+ * Describes a logger instance.
*
* The message MUST be a string or object implementing __toString().
*
* The message MAY contain placeholders in the form: {foo} where foo
* will be replaced by the context data in key "foo".
*
- * The context array can contain arbitrary data, the only assumption that
+ * The context array can contain arbitrary data. The only assumption that
* can be made by implementors is that if an Exception instance is given
* to produce a stack trace, it MUST be in a key named "exception".
*
@@ -23,8 +23,9 @@ interface LoggerInterface
* System is unusable.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function emergency($message, array $context = array());
@@ -35,8 +36,9 @@ public function emergency($message, array $context = array());
* trigger the SMS alerts and wake you up.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function alert($message, array $context = array());
@@ -46,8 +48,9 @@ public function alert($message, array $context = array());
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function critical($message, array $context = array());
@@ -56,8 +59,9 @@ public function critical($message, array $context = array());
* be logged and monitored.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function error($message, array $context = array());
@@ -68,8 +72,9 @@ public function error($message, array $context = array());
* that are not necessarily wrong.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function warning($message, array $context = array());
@@ -77,8 +82,9 @@ public function warning($message, array $context = array());
* Normal but significant events.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function notice($message, array $context = array());
@@ -88,8 +94,9 @@ public function notice($message, array $context = array());
* Example: User logs in, SQL logs.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function info($message, array $context = array());
@@ -97,18 +104,20 @@ public function info($message, array $context = array());
* Detailed debug information.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function debug($message, array $context = array());
/**
* Logs with an arbitrary level.
*
- * @param mixed $level
+ * @param mixed $level
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function log($level, $message, array $context = array());
}
diff --git a/vendor/psr/log/Psr/Log/LoggerTrait.php b/vendor/psr/log/Psr/Log/LoggerTrait.php
index 5912496..867225d 100644
--- a/vendor/psr/log/Psr/Log/LoggerTrait.php
+++ b/vendor/psr/log/Psr/Log/LoggerTrait.php
@@ -6,8 +6,8 @@
* This is a simple Logger trait that classes unable to extend AbstractLogger
* (because they extend another class, etc) can include.
*
- * It simply delegates all log-level-specific methods to the `log` method to
- * reduce boilerplate code that a simple Logger that does the same thing with
+ * It simply delegates all log-level-specific methods to the `log` method to
+ * reduce boilerplate code that a simple Logger that does the same thing with
* messages regardless of the error level has to implement.
*/
trait LoggerTrait
@@ -16,8 +16,9 @@ trait LoggerTrait
* System is unusable.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function emergency($message, array $context = array())
{
@@ -31,8 +32,9 @@ public function emergency($message, array $context = array())
* trigger the SMS alerts and wake you up.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function alert($message, array $context = array())
{
@@ -45,8 +47,9 @@ public function alert($message, array $context = array())
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function critical($message, array $context = array())
{
@@ -58,8 +61,9 @@ public function critical($message, array $context = array())
* be logged and monitored.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function error($message, array $context = array())
{
@@ -73,8 +77,9 @@ public function error($message, array $context = array())
* that are not necessarily wrong.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function warning($message, array $context = array())
{
@@ -85,8 +90,9 @@ public function warning($message, array $context = array())
* Normal but significant events.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function notice($message, array $context = array())
{
@@ -99,8 +105,9 @@ public function notice($message, array $context = array())
* Example: User logs in, SQL logs.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function info($message, array $context = array())
{
@@ -111,8 +118,9 @@ public function info($message, array $context = array())
* Detailed debug information.
*
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function debug($message, array $context = array())
{
@@ -122,10 +130,11 @@ public function debug($message, array $context = array())
/**
* Logs with an arbitrary level.
*
- * @param mixed $level
+ * @param mixed $level
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
abstract public function log($level, $message, array $context = array());
}
diff --git a/vendor/psr/log/Psr/Log/NullLogger.php b/vendor/psr/log/Psr/Log/NullLogger.php
index 553a3c5..d8cd682 100644
--- a/vendor/psr/log/Psr/Log/NullLogger.php
+++ b/vendor/psr/log/Psr/Log/NullLogger.php
@@ -3,7 +3,7 @@
namespace Psr\Log;
/**
- * This Logger can be used to avoid conditional log calls
+ * This Logger can be used to avoid conditional log calls.
*
* Logging should always be optional, and if no logger is provided to your
* library creating a NullLogger instance to have something to throw logs at
@@ -15,10 +15,11 @@ class NullLogger extends AbstractLogger
/**
* Logs with an arbitrary level.
*
- * @param mixed $level
+ * @param mixed $level
* @param string $message
- * @param array $context
- * @return null
+ * @param array $context
+ *
+ * @return void
*/
public function log($level, $message, array $context = array())
{
diff --git a/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php b/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php
index a932815..a0391a5 100644
--- a/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php
+++ b/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php
@@ -2,28 +2,32 @@
namespace Psr\Log\Test;
+use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
/**
- * Provides a base test class for ensuring compliance with the LoggerInterface
+ * Provides a base test class for ensuring compliance with the LoggerInterface.
*
- * Implementors can extend the class and implement abstract methods to run this as part of their test suite
+ * Implementors can extend the class and implement abstract methods to run this
+ * as part of their test suite.
*/
abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
{
/**
* @return LoggerInterface
*/
- abstract function getLogger();
+ abstract public function getLogger();
/**
- * This must return the log messages in order with a simple formatting: " "
+ * This must return the log messages in order.
*
- * Example ->error('Foo') would yield "error Foo"
+ * The simple formatting of the messages is: " ".
+ *
+ * Example ->error('Foo') would yield "error Foo".
*
* @return string[]
*/
- abstract function getLogs();
+ abstract public function getLogs();
public function testImplements()
{
@@ -61,7 +65,7 @@ public function provideLevelsAndMessages()
}
/**
- * @expectedException Psr\Log\InvalidArgumentException
+ * @expectedException \Psr\Log\InvalidArgumentException
*/
public function testThrowsOnInvalidLevel()
{
@@ -80,12 +84,19 @@ public function testContextReplacement()
public function testObjectCastToString()
{
- $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
+ if (method_exists($this, 'createPartialMock')) {
+ $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
+ } else {
+ $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
+ }
$dummy->expects($this->once())
->method('__toString')
->will($this->returnValue('DUMMY'));
$this->getLogger()->warning($dummy);
+
+ $expected = array('warning DUMMY');
+ $this->assertEquals($expected, $this->getLogs());
}
public function testContextCanContainAnything()
@@ -102,15 +113,28 @@ public function testContextCanContainAnything()
);
$this->getLogger()->warning('Crazy context data', $context);
+
+ $expected = array('warning Crazy context data');
+ $this->assertEquals($expected, $this->getLogs());
}
public function testContextExceptionKeyCanBeExceptionOrOtherValues()
{
- $this->getLogger()->warning('Random message', array('exception' => 'oops'));
- $this->getLogger()->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
+ $logger = $this->getLogger();
+ $logger->warning('Random message', array('exception' => 'oops'));
+ $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
+
+ $expected = array(
+ 'warning Random message',
+ 'critical Uncaught Exception!'
+ );
+ $this->assertEquals($expected, $this->getLogs());
}
}
class DummyTest
{
-}
\ No newline at end of file
+ public function __toString()
+ {
+ }
+}
diff --git a/vendor/psr/log/composer.json b/vendor/psr/log/composer.json
index 6bdcc21..87934d7 100644
--- a/vendor/psr/log/composer.json
+++ b/vendor/psr/log/composer.json
@@ -2,6 +2,7 @@
"name": "psr/log",
"description": "Common interface for logging libraries",
"keywords": ["psr", "psr-3", "log"],
+ "homepage": "https://github.com/php-fig/log",
"license": "MIT",
"authors": [
{
@@ -9,9 +10,17 @@
"homepage": "http://www.php-fig.org/"
}
],
+ "require": {
+ "php": ">=5.3.0"
+ },
"autoload": {
- "psr-0": {
- "Psr\\Log\\": ""
+ "psr-4": {
+ "Psr\\Log\\": "Psr/Log/"
+ }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
}
}
}