commit e3b92d18a7fee506af1bbfbd3d281eec1459c801
Author: KHOUBZA Younes
Date: Wed Dec 2 00:54:31 2020 +0100
add php-notify classes and rename namespaces
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..3383d44b
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,13 @@
+
+# Path-based git attributes
+# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
+
+# Ignore all test and documentation with "export-ignore".
+/.gitattributes export-ignore
+/.gitignore export-ignore
+/.travis.yml export-ignore
+/phpunit.xml.dist export-ignore
+/.scrutinizer.yml export-ignore
+/.styleci.yml export-ignore
+/tests export-ignore
+/.editorconfig export-ignore
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
new file mode 100644
index 00000000..c09f0dbc
--- /dev/null
+++ b/.github/workflows/tests.yaml
@@ -0,0 +1,48 @@
+name: Running tests
+
+on:
+ push:
+ pull_request:
+ schedule:
+ - cron: '0 * * * *'
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: true
+ matrix:
+ php: [ 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4 ]
+ dependency-version: [ prefer-lowest, prefer-stable ]
+
+ name: php ${{ matrix.php }} - ${{ matrix.dependency-version }}
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v1
+
+ - name: Cache dependencies
+ uses: actions/cache@v1
+ with:
+ path: ~/.composer/cache/files
+ key: php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php }}
+ coverage: none
+
+ - name: Require phpunit 6 for php >= 7.0
+ if: matrix.php >= 7.0
+ run: COMPOSER_MEMORY_LIMIT=-1 composer require "phpunit/phpunit:6.*" --no-interaction --no-update
+
+ - name: Require phpunit 9 for php >= 7.3
+ if: matrix.php >= 7.3
+ run: COMPOSER_MEMORY_LIMIT=-1 composer require "phpunit/phpunit:9.*" --no-interaction --no-update
+
+ - name: Install dependencies
+ run: COMPOSER_MEMORY_LIMIT=-1 composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
+
+ - name: Execute tests
+ run: vendor/bin/phpunit
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..409f0e32
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+.idea/
+vendor/
+composer.lock
+.phpunit.result.cache
+.phpcs-cache
diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist
new file mode 100644
index 00000000..93d245bc
--- /dev/null
+++ b/.phpcs.xml.dist
@@ -0,0 +1,625 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ src
+ tests
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ error
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Variable "%s" not allowed in double quoted string; use sprintf() or concatenation instead
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php
new file mode 100644
index 00000000..55dcbfa4
--- /dev/null
+++ b/.phpstorm.meta.php
@@ -0,0 +1,3 @@
+
+
+Easy flash notifications for PHP, Laravel, Symfony, Lumen
+
+:eyes: PHP Flasher library helps you to add flash notifications to your projects. This library was developed with the idea that you should be able to add flash notification to your application with ease and with few lines of code. No application-wide rewrites and no big investments upfront.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Introduction
+
+PHP Flasher library helps you to add flash notifications to your projects. This library was developed with the idea that you should be able to add flash notification to your application with ease and with few lines of code. No application-wide rewrites and no big investments upfront.
+
+# Why use PHP Flasher ?
+
+The PHP Flasher project supports a variety of notification libraries : __toastr.js__, __sweet alert 2__, __pnotify__ and __notyf__
+and its highly extendable so you can add custom adapters.
+
+This library is designed, so you can take full control when creating you notifications :
+
+> * Display multiple notifications
+> * Sort and filter notifications
+> * Render notification from JSON response with Ajax or Websockets
+> * Limit the number of displayed notifications
+> * Show notifications from different adapters at the same time
+> * implementations for popular frameworks : Symfony and Laravel
+> * ...and more
+
+
+## Official Documentation
+
+Documentation for Valet can be found on the [PHP Flasher website](https://php-flasher.github.io/).
+
+## License
+
+PHP Flasher is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
diff --git a/Renderer/ToastrRenderer.php b/Renderer/ToastrRenderer.php
new file mode 100644
index 00000000..6c32905a
--- /dev/null
+++ b/Renderer/ToastrRenderer.php
@@ -0,0 +1,79 @@
+config = $config;
+ $this->scripts = $config->get('adapters.toastr.scripts', array());
+ $this->styles = $config->get('adapters.toastr.styles', array());
+ $this->options = $config->get('adapters.toastr.options', array());
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function render(Envelope $envelope)
+ {
+ $context = $envelope->getContext();
+ $options = isset($context['options']) ? $context['options'] : array();
+
+ return sprintf(
+ "toastr.%s('%s', '%s', %s);",
+ $envelope->getType(),
+ $envelope->getMessage(),
+ $envelope->getTitle(),
+ json_encode($options)
+ );
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getScripts()
+ {
+ return $this->scripts;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function getStyles()
+ {
+ return $this->styles;
+ }
+
+ public function renderOptions()
+ {
+ return sprintf('toastr.options = %s;', json_encode($this->options));
+ }
+}
diff --git a/UPGRADING.md b/UPGRADING.md
new file mode 100644
index 00000000..e69de29b
diff --git a/composer.json b/composer.json
new file mode 100644
index 00000000..5792ae81
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,48 @@
+{
+ "name": "php-flasher/flasher-toastr",
+ "description": "PHP toastr adapter for php-flasher/flasher",
+ "keywords": [
+ "notify",
+ "php",
+ "laravel",
+ "symfony",
+ "Lumen",
+ "notifications",
+ "messages",
+ "alerts",
+ "pnotify",
+ "toastr "
+ ],
+ "homepage": "https://github.com/php-flasher/flasher-toastr",
+ "authors": [
+ {
+ "name": "Younes Khoubza",
+ "email": "younes.khoubza@gmail.com",
+ "homepage": "https://github.com/yoeunes",
+ "role": "Developer"
+ }
+ ],
+ "license": "MIT",
+ "require": {
+ "php": ">=5.3",
+ "php-flasher/flasher": "^1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "4.8.36"
+ },
+ "autoload": {
+ "psr-4": {
+ "Flasher\\Toastr\\": "src"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Flasher\\Toastr\\Tests\\": "tests/"
+ }
+ },
+ "config": {
+ "sort-packages": true
+ },
+ "minimum-stability": "dev",
+ "prefer-stable": true
+}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 00000000..2621c486
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,22 @@
+
+
+
+
+ tests
+
+
+
+
+ src/
+
+
+