-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
251e80c
commit 6a4caa9
Showing
6 changed files
with
176 additions
and
22 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
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 |
---|---|---|
@@ -0,0 +1,125 @@ | ||
<?php | ||
|
||
namespace Tamtamchik\SimpleFlash; | ||
|
||
trait FlashStubs | ||
{ | ||
/** | ||
* Base method for adding messages to flash. | ||
* | ||
* @param string $message - message text | ||
* @param string $type - message type: success, info, warning, error | ||
* | ||
* @return Engine $this | ||
*/ | ||
public static function message($message, $type = 'info') | ||
{ | ||
return self::__callStatic(__FUNCTION__, func_get_args()); | ||
} | ||
|
||
/** | ||
* Returns Bootstrap ready HTML for Engine messages. | ||
* | ||
* @param string $type - message type: success, info, warning, error | ||
* | ||
* @return string - HTML with flash messages | ||
*/ | ||
public static function display($type = null) | ||
{ | ||
return self::__callStatic(__FUNCTION__, func_get_args()); | ||
} | ||
|
||
/** | ||
* Returns if there are any messages in container. | ||
* | ||
* @param string $type - message type: success, info, warning, error | ||
* | ||
* @return bool | ||
*/ | ||
public static function hasMessages($type = null) | ||
{ | ||
return self::__callStatic(__FUNCTION__, func_get_args()); | ||
} | ||
|
||
/** | ||
* Clears messages from session store. | ||
* | ||
* @param string $type - message type: success, info, warning, error | ||
* | ||
* @return Engine $this | ||
*/ | ||
public static function clear($type = null) | ||
{ | ||
return self::__callStatic(__FUNCTION__, func_get_args()); | ||
} | ||
|
||
/** | ||
* Shortcut for error message. | ||
* | ||
* @param $message - message text | ||
* | ||
* @return Engine $this | ||
*/ | ||
public static function error($message) | ||
{ | ||
return self::__callStatic(__FUNCTION__, func_get_args()); | ||
} | ||
|
||
/** | ||
* Shortcut for warning message. | ||
* | ||
* @param $message - message text | ||
* | ||
* @return Engine $this | ||
*/ | ||
public static function warning($message) | ||
{ | ||
return self::__callStatic(__FUNCTION__, func_get_args()); | ||
} | ||
|
||
/** | ||
* Shortcut for info message. | ||
* | ||
* @param $message - message text | ||
* | ||
* @return Engine $this | ||
*/ | ||
public static function info($message) | ||
{ | ||
return self::__callStatic(__FUNCTION__, func_get_args()); | ||
} | ||
|
||
/** | ||
* Shortcut for success message. | ||
* | ||
* @param $message - message text | ||
* | ||
* @return Engine $this | ||
*/ | ||
public static function success($message) | ||
{ | ||
return self::__callStatic(__FUNCTION__, func_get_args()); | ||
} | ||
|
||
/** | ||
* Setter for $template. | ||
* | ||
* @param TemplateInterface $template | ||
* | ||
* @return Engine $this | ||
*/ | ||
public static function setTemplate(TemplateInterface $template) | ||
{ | ||
return self::__callStatic(__FUNCTION__, func_get_args()); | ||
} | ||
|
||
/** | ||
* Getter for $template. | ||
* | ||
* @return TemplateInterface | ||
*/ | ||
public static function getTemplate() | ||
{ | ||
return self::__callStatic(__FUNCTION__, func_get_args()); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
use Tamtamchik\SimpleFlash\FlashInterface; | ||
|
||
class WrapperClass | ||
{ | ||
public function __construct(FlashInterface $flash) | ||
{ | ||
$this->flasher = $flash; | ||
} | ||
} |