-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ARCANEDEV/develop
Updating the package for Laravel 5.x
- Loading branch information
Showing
15 changed files
with
120 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
language: php | ||
|
||
sudo: false | ||
|
||
php: | ||
- 5.5.9 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- hhvm | ||
|
||
sudo: false | ||
env: | ||
- TESTBENCH_VERSION=3.0.* | ||
- TESTBENCH_VERSION=3.1.* | ||
- TESTBENCH_VERSION=3.2.* | ||
|
||
before_script: | ||
- travis_retry composer self-update | ||
- travis_retry composer install --prefer-source --no-interaction | ||
- travis_retry composer require --prefer-source --no-interaction --dev "orchestra/testbench:${TESTBENCH_VERSION}" | ||
|
||
script: | ||
- composer validate | ||
- mkdir -p build/logs | ||
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover | ||
|
||
after_script: | ||
- if [ "$TRAVIS_PHP_VERSION" != "7.0" ] && [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi | ||
- if [ "$TRAVIS_PHP_VERSION" != "7.0" ] && [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi | ||
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi | ||
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
{ | ||
"name": "ARCANEDEV", | ||
"email": "[email protected]", | ||
"homepage": "https://github.com/ARCANEDEV", | ||
"homepage": "https://github.com/arcanedev-maroc", | ||
"role": "Developer" | ||
} | ||
], | ||
|
@@ -18,7 +18,6 @@ | |
"arcanedev/support": "~3.0" | ||
}, | ||
"require-dev": { | ||
"orchestra/testbench": "~3.1", | ||
"phpunit/phpcov": "~2.0", | ||
"phpunit/phpunit": "~4.0|~5.0" | ||
}, | ||
|
@@ -33,9 +32,12 @@ | |
"Arcanedev\\Notify\\Tests\\": "tests/" | ||
} | ||
}, | ||
"scripts": { | ||
"testbench": "composer require --dev \"orchestra/testbench=~3.0\"" | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "4.0-dev" | ||
"dev-master": "3.2-dev" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<?php namespace Arcanedev\Notify\Contracts; | ||
|
||
/** | ||
* Interface NotifyInterface | ||
* Interface Notify | ||
* | ||
* @package Arcanedev\Notify\Contracts | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
interface NotifyInterface | ||
interface Notify | ||
{ | ||
/* ------------------------------------------------------------------------------------------------ | ||
| Getters & Setters | ||
|
4 changes: 2 additions & 2 deletions
4
src/Contracts/SessionStoreInterface.php → src/Contracts/SessionStore.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<?php namespace Arcanedev\Notify\Contracts; | ||
|
||
/** | ||
* Interface SessionStoreInterface | ||
* Interface SessionStore | ||
* | ||
* @package Arcanedev\Notify\Contracts | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
interface SessionStoreInterface | ||
interface SessionStore | ||
{ | ||
/* ------------------------------------------------------------------------------------------------ | ||
| Main Functions | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
<?php namespace Arcanedev\Notify; | ||
|
||
use Arcanedev\Notify\Contracts\NotifyInterface; | ||
use Arcanedev\Notify\Contracts\SessionStoreInterface; | ||
use Arcanedev\Notify\Contracts\Notify as NotifyContract; | ||
use Arcanedev\Notify\Contracts\SessionStore; | ||
|
||
/** | ||
* Class Notify | ||
* | ||
* @package Arcanedev\Notify | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
class Notify implements NotifyInterface | ||
class Notify implements NotifyContract | ||
{ | ||
/* ------------------------------------------------------------------------------------------------ | ||
| Properties | ||
|
@@ -20,16 +20,12 @@ class Notify implements NotifyInterface | |
* | ||
* @var string | ||
*/ | ||
protected $sessionPrefix = ''; | ||
protected $sessionPrefix; | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
| Properties | ||
| ------------------------------------------------------------------------------------------------ | ||
*/ | ||
/** | ||
* The session writer. | ||
* | ||
* @var SessionStoreInterface | ||
* @var \Arcanedev\Notify\Contracts\SessionStore | ||
*/ | ||
private $session; | ||
|
||
|
@@ -40,10 +36,10 @@ class Notify implements NotifyInterface | |
/** | ||
* Create a new flash notifier instance. | ||
* | ||
* @param SessionStoreInterface $session | ||
* @param string $prefix | ||
* @param \Arcanedev\Notify\Contracts\SessionStore $session | ||
* @param string $prefix | ||
*/ | ||
public function __construct(SessionStoreInterface $session, $prefix) | ||
public function __construct(SessionStore $session, $prefix) | ||
{ | ||
$this->session = $session; | ||
$this->sessionPrefix = $prefix; | ||
|
@@ -123,13 +119,11 @@ public function ready() | |
*/ | ||
public function flash($message, $type = '', array $options = []) | ||
{ | ||
$data = [ | ||
$this->sessionPrefix . 'message' => $message, | ||
$this->sessionPrefix . 'type' => $type, | ||
$this->sessionPrefix . 'options' => json_encode($options), | ||
]; | ||
|
||
$this->session->flash($data); | ||
$this->session->flash([ | ||
$this->getPrefixedName('message') => $message, | ||
$this->getPrefixedName('type') => $type, | ||
$this->getPrefixedName('options') => json_encode($options), | ||
]); | ||
|
||
return $this; | ||
} | ||
|
@@ -138,6 +132,12 @@ public function flash($message, $type = '', array $options = []) | |
| Other Functions | ||
| ------------------------------------------------------------------------------------------------ | ||
*/ | ||
|
||
private function getPrefixedName($name) | ||
{ | ||
return "{$this->sessionPrefix}.$name"; | ||
} | ||
|
||
/** | ||
* Get session value. | ||
* | ||
|
@@ -147,6 +147,8 @@ public function flash($message, $type = '', array $options = []) | |
*/ | ||
private function getSession($name) | ||
{ | ||
return $this->session->get($this->sessionPrefix . $name); | ||
return $this->session->get( | ||
$this->getPrefixedName($name) | ||
); | ||
} | ||
} |
Oops, something went wrong.