Prowl\Message::setDescription PHP Method

setDescription() public method

Sets the event description.
public setDescription ( string $sDescription ) : Message
$sDescription string The event description.
return Message
    public function setDescription($sDescription)
    {
        $iContentLength = mb_strlen($sDescription, 'utf-8');
        if ($iContentLength > 10000) {
            throw new \InvalidArgumentException('Description is too long. Limit is 10.000, yours is ' . $iContentLength);
        }
        $this->sDescription = (string) $sDescription;
        return $this;
    }

Usage Example

Ejemplo n.º 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::setDescription