@param int $id
@param string $message

@return bool
181693
public function clarify($id, $message)
    {
        $data = new ReturnUnitClarifyTransfer();
        $data->message = $message;

        $endpoint = new Clarify($this->getTransport());
        $endpoint->setId($id);
        $endpoint->setTransfer($data);

        try {
            $result = $endpoint->performRequest();
        } catch (ResourceNotFoundException $e) {
            return false;
        }

        return $result['status'] == 204;
    }
484222
public function integer($message = null)
    {
        $this->setRule(__FUNCTION__, function($val)
                       {
                           return !(filter_var($val, FILTER_VALIDATE_INT) === FALSE);
                       }, $message);
        return $this;
    }
1361705
public function setMessageId($id = true)
    {
        if ($id === null || $id === false) {
            return $this;
        } elseif ($id === true) {
            $id = $this->createMessageId();
        }

        if ($this->_messageId === null) {
            $id = $this->_filterOther($id);
            $this->_messageId = $id;
            $this->_storeHeader('Message-Id', '<' . $this->_messageId . '>');
        } else {
            /**
             * @see Zend_Mail_Exception
             */
            // require_once 'Zend/Mail/Exception.php';
            throw new Zend_Mail_Exception('Message-ID set twice');
        }

        return $this;
    }
1157201
public function markEmailAsSent($id) {

        $emailMessage = $this->model->find($id);

        $emailMessage->sent = 1;

        return $emailMessage->save();
    }
845994
protected function fireEvent($event, $message)
    {
        if (!isset($this->notification)) {
            return true;
        }

        return $this->getNotification()->fire($event, $this, $message);
    }
1210027
public function notice(string $id, string $message, int $status = 400)
    {
        Log::info($id . ' : ' . $message);

        return response ()->json (['success' => false, 'id' => $id, 'message' => $message], $status);
    }
1102936
private function shouldPersistMessage(PersistentMessage $message): bool
    {
        return ($message instanceof Command && $this->persistCommands) ||
        ($message instanceof Event && $this->persistEvents);
    }
1075346
public function acknowledge(MessageInterface $message)
    {
        InvalidMessageException::assertMessageInstanceOf($message, DbalMessage::class);

        $this->dbal->beginTransaction();

        $sql = sprintf(
            'SELECT id FROM %s WHERE id=:id FOR UPDATE',
            $this->connection->getTableName()
        );

        $row = $this->dbal->executeQuery(
            $sql,
            ['id' => $message->getId(), ],
            ['id' => Type::INTEGER, ]
        )->fetch();
        $affectedRows = null;
        if (count($row)) {
            try {
                $affectedRows = $this->dbal->delete($this->connection->getTableName(), ['id' => $message->getId()], [
                    'id' => Type::INTEGER,
                ]);
                $this->dbal->commit();
            } catch (\Exception $e) {
                sleep(1);
                try {
                    $affectedRows = $this->dbal->delete(
                        $this->connection->getTableName(),
                        ['id' => $message->getId()],
                        ['id' => Type::INTEGER, ]
                    );
                    $this->dbal->commit();
                } catch (\Exception $e) {
                    $this->dbal->rollBack();
                }
            }
        }
        if (1 !== $affectedRows) {
            throw new \LogicException(sprintf(
                'Expected record was removed but it is not. id: "%s"',
                $message->getId()
            ));
        }
    }
464783
public function getDirectMessagesById($id)
	{
		// Check the rate limit for remaining hits
		$this->checkRateLimit('direct_messages', 'show');

		// Set the API path
		$path = '/direct_messages/show.json';

		$data['id'] = $id;

		// Send the request.
		return $this->sendRequest($path, 'GET', $data);
	}
541800
public function smtpGetEmailInfoById($id)
    {
        if (empty($id)) {
            return $this->handleError('Empty id');
        }

        $requestResult = $this->sendRequest('/smtp/emails/' . $id);

        return $this->handleResult($requestResult);
    }
582590
private function sendMessage($receiver, $message)
    {
        $id = null;

        switch ($message->type)
        {
            case 'text':
                $id = $this->broadcast
                        ? $this->gateway()->sendBroadcastMessage($receiver, $message->message)
                        : $this->gateway()->sendMessage($receiver, $message->message);
                break;
            case 'image':
                $id = $this->broadcast
                        ? $this->gateway()->sendBroadcastImage($receiver, $message->file, false, $message->filesize, $message->hash, $message->caption)
                        : $this->gateway()->sendMessageImage($receiver, $message->file, false, $message->filesize, $message->hash, $message->caption);
                break;
            case 'audio':
                $id = $this->broadcast
                        ? $this->gateway()->sendBroadcastAudio($receiver, $message->file, false, $message->filesize, $message->hash)
                        : $this->gateway()->sendMessageAudio($receiver, $message->file, false, $message->filesize, $message->hash);
                break;
            case 'video':
                $id = $this->broadcast
                        ? $this->gateway()->sendBroadcastVideo($receiver, $message->file, false, $message->filesize, $message->hash, $message->caption)
                        : $this->gateway()->sendMessageVideo($receiver, $message->file, false, $message->filesize, $message->hash, $message->caption);
                break;
            case 'location':
                $id = $this->broadcast 
                        ? $this->gateway()->sendBroadcastLocation($receiver, $message->longitude, $message->latitude, $message->caption, $message->url)
                        : $this->gateway()->sendMessageLocation($receiver, $message->longitude, $message->latitude, $message->caption, $message->url);
                break;
            case 'vcard':
                $id = $this->broadcast 
                        ? $this->gateway()->sendBroadcastVcard($receiver, $message->name, $message->vcard->show())
                        : $this->gateway()->sendVcard($receiver, $message->name, $message->vcard->show());
                break;
            default:
                            
            break;
        }

        while ($this->gateway()->pollMessage());

        return $id;
    }
416909
public function isAncestor(int $id): Bool
    {
        if ( ! is_null($this->getAncestor($id))) {
            return true;
        }

        return false;
    }
569994
public function setMessageId($message)
    {
        if (is_bool($message)) {
            $this->_messageId = $message;
        } else {
            if (!preg_match('/^\<.+@.+\>$/', $message)) {
                throw new InvalidArgumentException('Invalid format to Message-ID. The text should be something like "<uuid@server.com>"');
            }
            $this->_messageId = $message;
        }

        return $this;
    }
1064385
private static function packJsonError($code, $message, $id) {

        if ( !is_null($id) ) {

            return array(
                'jsonrpc' => '2.0',
                'error' => array(
                    'code' => $code,
                    'message' => $message
                ),
                'id' => $id
            );

        } else {

            return null;

        }

    }
117219
public function theResponseShouldContainErrorData($id, $message, TableNode $table)
    {
        Assertions::assertEquals(200, $this->response->getStatusCode());

        $this->theResponseShouldContainErrorWithMessage($id, $message);
        $error = $this->getFieldFromBody('error', $this->response->getBody());

        Assertions::assertArrayHasKey('data', $error);
        Assertions::assertEquals($table->getRowsHash(), $error['data']);
    }
1225987
public function read($ID)
    {
        $member = Member::currentUser();
        if (!$member) {
            return false;
        }

        if ($ID) {
            $notification = InternalNotification::get()
                ->filter([
                    'ID' => $ID,
                    'ToID' => $member->ID,
                    'IsRead' => false
                ])->first();
            if ($notification) {
                $notification->IsRead = true;
                $notification->write();
                return true;
            }
        }
        return false;
    }
1051226
public function deleteMessage(Message $message)
    {
        if ($this->db->delete('QueueMessages', ['handle' => $message->handle])) {
            return true;
        }

        return false;
    }