Skip to content

Commit

Permalink
refactor: Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zarei-dev committed Jun 13, 2022
1 parent ab0eb0e commit 196252f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/BetterNotice.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ class BetterNotice {
'Success',
];

private function __construct() {
return;
}
private function __construct() {}

/**
* Create a new instance of BetterNotice
Expand All @@ -36,6 +34,7 @@ protected static function _object_maker( string $type, string $message )
*
* @param string $name
* @param array $arguments
* @return Notice|false
*/
public static function __callStatic( string $name, array $arguments)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Notice.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __construct( string $type, string $message ) {
$this->message = $message;
$this->type = $type;

add_action( 'admin_notices', array( $this, 'print_notice' ) );
\add_action( 'admin_notices', array( $this, 'print_notice' ) );

return $this;
}
Expand All @@ -25,7 +25,7 @@ public function __construct( string $type, string $message ) {
* @return string
* TODO: Sanitize HTML Tags
*/
protected function _notice_body()
protected function _notice_body(): string
{
$notice_body = '<div class="notice notice-' . $this->type . ' is-dismissible">';
$notice_body .= '<p>' . $this->message . '</p>';
Expand All @@ -36,7 +36,7 @@ protected function _notice_body()
/**
* Print the notice
*/
public function print_notice()
public function print_notice(): bool
{
echo $this->_notice_body();

Expand Down

0 comments on commit 196252f

Please sign in to comment.