Prowl\Message::setEvent PHP Method

setEvent() public method

Sets the event.
public setEvent ( string $sEvent ) : Message
$sEvent string The event.
return Message
    public function setEvent($sEvent)
    {
        $iContentLength = mb_strlen($sEvent, 'utf-8');
        if ($iContentLength > 1024) {
            throw new \InvalidArgumentException('Event length is limited to 1024 chars. Yours is ' . $iContentLength);
        }
        $this->sEvent = (string) $sEvent;
        return $this;
    }

Usage Example

Example #1
0
 protected function send(MessageInterface $message, RecipientInterface $recipient)
 {
     $oProwl = new Connector();
     $oMsg = new Message();
     try {
         $oProwl->setIsPostRequest(true);
         $oMsg->setPriority(0);
         $oProwl->setFilterCallback(function ($sText) {
             return $sText;
         });
         $oMsg->addApiKey($recipient->getInfo('prowl_app.api_key'));
         $oMsg->setEvent($message->getSubject());
         $oMsg->setDescription($message->getContent());
         $oMsg->setApplication($this->appName);
         $oResponse = $oProwl->push($oMsg);
         if ($oResponse->isError()) {
             $this->errors[] = $oResponse->getErrorAsString();
         }
     } catch (\InvalidArgumentException $oIAE) {
         $this->errors[] = $oIAE->getMessage();
     } catch (\OutOfRangeException $oOORE) {
         $this->errors[] = $oOORE->getMessage();
     }
 }
All Usage Examples Of Prowl\Message::setEvent