public function setPayload($data)
    {
        if (!is_string($data)) {
            if (is_array($data)) {
                $data = json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
            } else {
                $data = serialize($data);
            }
        }

        $maxLength = 255;
        if (mb_strlen($data) > $maxLength) {
            // Truncate too long payload
            $data = mb_substr($data, 0, $maxLength - 3) . '...';
        }

        $this->payload = $data ? $data : null;

        return $this;
    }
public function setPayload($data)
    {
        if (!is_string($data)) {
            if (is_array($data)) {
                $data = json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
            } else {
                $data = serialize($data);
            }
        }

        $maxLength = 255;
        if (mb_strlen($data) > $maxLength) {
            // Truncate too long payload
            $data = mb_substr($data, 0, $maxLength - 3) . '...';
        }

        $this->payload = $data ? $data : null;

        return $this;
    }
public function setPayload ( $ data ) { if ( ! is_string ( $ data ) ) { if ( is_array ( $ data ) ) { $ data = json_encode ( $ data , JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ; } else { $ data = serialize ( $ data ) ; } } $ maxLength = 255 ; if ( mb_strlen ( $ data ) > $ maxLength ) { // Truncate too long payload $ data = mb_substr ( $ data , 0 , $ maxLength - 3 ) . '...' ; } $ this -> payload = $ data ? $ data : null ; return $ this ; }
Set payload value

@param mixed $data [1, 4, 5] or "1,4,5" or Object

@return $this
Set payload value