Prowl\Message::setApplication PHP Method

setApplication() public method

Sets the application.
public setApplication ( string $sApp ) : Message
$sApp string The name of the sending application.
return Message
    public function setApplication($sApp)
    {
        $iContentLength = mb_strlen($sApp, 'utf-8');
        if ($iContentLength > 254) {
            throw new \InvalidArgumentException('Application length is limited to 254 chars. Yours is ' . $iContentLength);
        }
        $this->sApplication = (string) $sApp;
        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::setApplication