mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 21:12:15 +09:00
Fix inconsistent use of short array syntax
This commit is contained in:
parent
1abd6a04c9
commit
20f63430f9
1 changed files with 15 additions and 14 deletions
|
|
@ -12,21 +12,22 @@ class Push
|
||||||
*/
|
*/
|
||||||
protected $caller = '';
|
protected $caller = '';
|
||||||
protected $from = 0;
|
protected $from = 0;
|
||||||
protected $to = array();
|
protected $to = [];
|
||||||
|
protected $topics = [];
|
||||||
protected $subject = '';
|
protected $subject = '';
|
||||||
protected $content = '';
|
protected $content = '';
|
||||||
protected $metadata = [];
|
protected $metadata = [];
|
||||||
protected $data = [];
|
protected $data = [];
|
||||||
protected $errors = array();
|
protected $errors = [];
|
||||||
protected $success_tokens = array();
|
protected $success_tokens = [];
|
||||||
protected $deleted_tokens = array();
|
protected $deleted_tokens = [];
|
||||||
protected $updated_tokens = array();
|
protected $updated_tokens = [];
|
||||||
protected $sent = 0;
|
protected $sent = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static properties.
|
* Static properties.
|
||||||
*/
|
*/
|
||||||
protected static $_drivers = array();
|
protected static $_drivers = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a custom Push driver.
|
* Add a custom Push driver.
|
||||||
|
|
@ -56,7 +57,7 @@ class Push
|
||||||
$driver_class = '\Rhymix\Framework\Drivers\Push\\' . $name;
|
$driver_class = '\Rhymix\Framework\Drivers\Push\\' . $name;
|
||||||
if (class_exists($driver_class))
|
if (class_exists($driver_class))
|
||||||
{
|
{
|
||||||
$driver_config = config('push.' . $name) ?: array();
|
$driver_config = config('push.' . $name) ?: [];
|
||||||
return self::$_drivers[$name] = $driver_class::getInstance($driver_config);
|
return self::$_drivers[$name] = $driver_class::getInstance($driver_config);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -72,29 +73,29 @@ class Push
|
||||||
*/
|
*/
|
||||||
public static function getSupportedDrivers(): array
|
public static function getSupportedDrivers(): array
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = [];
|
||||||
foreach (Storage::readDirectory(__DIR__ . '/drivers/push', false) as $filename)
|
foreach (Storage::readDirectory(__DIR__ . '/drivers/push', false) as $filename)
|
||||||
{
|
{
|
||||||
$driver_name = substr($filename, 0, -4);
|
$driver_name = substr($filename, 0, -4);
|
||||||
$class_name = '\Rhymix\Framework\Drivers\Push\\' . $driver_name;
|
$class_name = '\Rhymix\Framework\Drivers\Push\\' . $driver_name;
|
||||||
if ($class_name::isSupported())
|
if ($class_name::isSupported())
|
||||||
{
|
{
|
||||||
$result[$driver_name] = array(
|
$result[$driver_name] = [
|
||||||
'name' => $class_name::getName(),
|
'name' => $class_name::getName(),
|
||||||
'required' => $class_name::getRequiredConfig(),
|
'required' => $class_name::getRequiredConfig(),
|
||||||
'optional' => $class_name::getOptionalConfig(),
|
'optional' => $class_name::getOptionalConfig(),
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (self::$_drivers as $driver_name => $driver)
|
foreach (self::$_drivers as $driver_name => $driver)
|
||||||
{
|
{
|
||||||
if ($driver->isSupported())
|
if ($driver->isSupported())
|
||||||
{
|
{
|
||||||
$result[$driver_name] = array(
|
$result[$driver_name] = [
|
||||||
'name' => $driver->getName(),
|
'name' => $driver->getName(),
|
||||||
'required' => $driver->getRequiredConfig(),
|
'required' => $driver->getRequiredConfig(),
|
||||||
'optional' => $driver->getOptionalConfig(),
|
'optional' => $driver->getOptionalConfig(),
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ksort($result);
|
ksort($result);
|
||||||
|
|
@ -184,7 +185,7 @@ class Push
|
||||||
public function setContent(string $content): bool
|
public function setContent(string $content): bool
|
||||||
{
|
{
|
||||||
$this->content = utf8_trim(utf8_clean($content));
|
$this->content = utf8_trim(utf8_clean($content));
|
||||||
$this->content = strtr($this->content, array("\r\n" => "\n"));
|
$this->content = strtr($this->content, ["\r\n" => "\n"]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -432,7 +433,7 @@ class Push
|
||||||
$args = new \stdClass;
|
$args = new \stdClass;
|
||||||
$args->member_srl = $this->getRecipients();
|
$args->member_srl = $this->getRecipients();
|
||||||
$args->device_token_type = [];
|
$args->device_token_type = [];
|
||||||
$driver_types = config('push.types') ?: array();
|
$driver_types = config('push.types') ?: [];
|
||||||
if(isset($driver_types['fcm']) || isset($driver_types['fcmv1']))
|
if(isset($driver_types['fcm']) || isset($driver_types['fcmv1']))
|
||||||
{
|
{
|
||||||
$args->device_token_type[] = 'fcm';
|
$args->device_token_type[] = 'fcm';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue