LaravelFCM\Message\OptionsPriorities::isValid PHP Method

isValid() static public method

check if this priority is supported by fcm
static public isValid ( $priority ) : boolean
$priority
return boolean
    static function isValid($priority)
    {
        return in_array($priority, static::getPriorities());
    }

Usage Example

Example #1
0
 /**
  * Sets the priority of the message. Valid values are "normal" and "high."
  * By default, messages are sent with normal priority
  *
  * @param String $priority
  *
  * @return \LaravelFCM\Message\OptionsBuilder
  *
  * @throws InvalidOptionsException
  */
 public function setPriority($priority)
 {
     if (!OptionsPriorities::isValid($priority)) {
         throw new InvalidOptionsException('priority is not valid, please refer to the documentation or use the constants of the class "OptionsPriorities"');
     }
     $this->priority = $priority;
     return $this;
 }
OptionsPriorities