Skip to content

Commit

Permalink
Merge pull request #5 from digiom/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
frescoref committed Feb 10, 2023
2 parents 6513f68 + d7b9fb2 commit 1bc3a69
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"psr-4": {"Digiom\\Wotices\\": "src/"}
},
"require": {
"php": ">=5.6"
"php": ">=7.0"
}
}
32 changes: 17 additions & 15 deletions src/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Countable;
use Exception;
use InvalidArgumentException;
use Traversable;
use WP_Screen;
use WP_User;
use Digiom\Wotices\Abstracts\NoticeAbstract;
Expand Down Expand Up @@ -275,13 +276,14 @@ public function add($id, $args = [])
* @param array $args
*
* @return bool
* @throws Exception
*/
public function create($args = [])
{
$defaultArgs =
[
'prefix' => '',
'id' => mt_rand(3, 500),
'id' => random_int(3, 500),
'type' => 'info',
'data' => '',
'extra_data' => '',
Expand Down Expand Up @@ -584,7 +586,7 @@ private function is_screen($args)
*
* @param string $key
*/
public function remove($key)
public function remove(string $key)
{
if($this->has($key))
{
Expand Down Expand Up @@ -645,63 +647,63 @@ protected function dismissible($notice_id)
/**
* @return bool
*/
public function isUseAdminNotices()
public function isUseAdminNotices(): bool
{
return $this->use_admin_notices;
}

/**
* @param bool $use_admin_notices
*/
public function setUseAdminNotices($use_admin_notices)
public function setUseAdminNotices(bool $use_admin_notices)
{
$this->use_admin_notices = $use_admin_notices;
}

/**
* @return bool
*/
public function isUseAllAdminNotices()
public function isUseAllAdminNotices(): bool
{
return $this->use_all_admin_notices;
}

/**
* @param bool $use_all_admin_notices
*/
public function setUseAllAdminNotices($use_all_admin_notices)
public function setUseAllAdminNotices(bool $use_all_admin_notices)
{
$this->use_all_admin_notices = $use_all_admin_notices;
}

/**
* @return bool
*/
public function isUseNetworkAdminNotices()
public function isUseNetworkAdminNotices(): bool
{
return $this->use_network_admin_notices;
}

/**
* @param bool $use_network_admin_notices
*/
public function setUseNetworkAdminNotices($use_network_admin_notices)
public function setUseNetworkAdminNotices(bool $use_network_admin_notices)
{
$this->use_network_admin_notices = $use_network_admin_notices;
}

/**
* @return bool
*/
public function isUseUserAdminNotices()
public function isUseUserAdminNotices(): bool
{
return $this->use_user_admin_notices;
}

/**
* @param bool $use_user_admin_notices
*/
public function setUseUserAdminNotices($use_user_admin_notices)
public function setUseUserAdminNotices(bool $use_user_admin_notices)
{
$this->use_user_admin_notices = $use_user_admin_notices;
}
Expand All @@ -715,7 +717,7 @@ public function setUseUserAdminNotices($use_user_admin_notices)
* @return true
* @throws Exception
*/
public function registerType($name, $class)
public function registerType(string $name, $class): bool
{
if(empty($name))
{
Expand All @@ -742,7 +744,7 @@ public function registerType($name, $class)
*
* @return bool
*/
public function save()
public function save(): bool
{
if($this->count())
{
Expand All @@ -765,7 +767,7 @@ public function fetch()
*
* @return bool
*/
public function delete()
public function delete(): bool
{
return delete_transient($this->getTransientName());
}
Expand All @@ -785,7 +787,7 @@ public function has($key)
/**
* Count number of notices in the queue
*/
public function count()
public function count(): int
{
return count($this->notices);
}
Expand All @@ -806,7 +808,7 @@ public function __destruct()
*
* @return ArrayIterator
*/
public function getIterator()
public function getIterator(): Traversable
{
return new ArrayIterator($this->notices);
}
Expand Down

0 comments on commit 1bc3a69

Please sign in to comment.