diff --git a/.gitignore b/.gitignore index a4854be..195297b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ npm-debug.log # Laravel 4 specific bootstrap/compiled.php app/storage/ +.idea # Laravel 5 & Lumen specific public/storage diff --git a/src/TextLocalOriginal.php b/src/TextLocalOriginal.php index f2f25f2..f0c8ca7 100644 --- a/src/TextLocalOriginal.php +++ b/src/TextLocalOriginal.php @@ -18,7 +18,7 @@ * * @package Rahulreghunath\Textlocal * @subpackage API - * @author Andy Dixon + * @author Andy Dixon , Rahul Reghunath * @version 1.4-IN * @const REQUEST_URL URL to make the request to * @const REQUEST_TIMEOUT Timeout in seconds for the HTTP request @@ -69,7 +69,7 @@ public function getLastRequest() * @param null $sched * @param false $test * @param null $receiptURL - * @param numm $custom + * @param null $custom * @param false $optouts * @param false $simpleReplyService * @return array|mixed @@ -186,7 +186,7 @@ private function _sendRequestCurl($command, $params) * @param null $sender * @param false $test * @param null $receiptURL - * @param numm $custom + * @param null $custom * @param false $optouts * @param false $simpleReplyService * @return array|mixed @@ -300,6 +300,7 @@ public function sendMmsGroup($groupId, $fileSource, $message, $sched = null, $te /** *Returns reseller customer's ID's * @return array + * @throws Exception **/ public function getUsers() @@ -342,8 +343,11 @@ public function transferCredits($user, $credits) return $this->_sendRequest('transfer_credits', $params); } - /**Get templates from an account **/ - + /** + * Get templates from an account + * @return array|mixed + * @throws Exception + */ public function getTemplates() { return $this->_sendRequest('get_templates'); @@ -351,7 +355,8 @@ public function getTemplates() /** Check the availability of a keyword * @param $keyword - * return array|mixed + * @return array|mixed + * @throws Exception */ public function checkKeyword($keyword) { @@ -364,6 +369,7 @@ public function checkKeyword($keyword) * Create a new contact group * @param $name * @return array|mixed + * @throws Exception */ public function createGroup($name) { @@ -402,6 +408,7 @@ public function getContacts($groupId, $limit, $startPos = 0) * @param $numbers * @param string $groupid * @return array|mixed + * @throws Exception */ public function createContacts($numbers, $groupid = '5') { @@ -419,10 +426,10 @@ public function createContacts($numbers, $groupid = '5') /** * Create bulk contacts - with name and custom information from an array of: * [first_name] [last_name] [number] [custom1] [custom2] [custom3] - * * @param array $contacts * @param string $groupid * @return array|mixed + * @throws Exception */ function createContactsBulk($contacts, $groupid = '5') { @@ -437,6 +444,7 @@ function createContactsBulk($contacts, $groupid = '5') /** * Get a list of groups and group IDs * @return array|mixed + * @throws Exception */ public function getGroups() { @@ -447,6 +455,7 @@ public function getGroups() * Get the status of a message based on the Message ID - this can be taken from sendSMS or from a history report * @param $messageid * @return array|mixed + * @throws Exception */ public function getMessageStatus($messageid) { @@ -458,6 +467,7 @@ public function getMessageStatus($messageid) * Get the status of a message based on the Batch ID - this can be taken from sendSMS or from a history report * @param $batchid * @return array|mixed + * @throws Exception */ public function getBatchStatus($batchid) { @@ -468,6 +478,7 @@ public function getBatchStatus($batchid) /** * Get sender names * @return array|mixed + * @throws Exception */ public function getSenderNames() { @@ -477,6 +488,7 @@ public function getSenderNames() /** * Get inboxes available on the account * @return array|mixed + * * @throws Exception */ public function getInboxes() { @@ -486,6 +498,7 @@ public function getInboxes() /** * Get Credit Balances * @return array + * @throws Exception */ public function getBalance() { @@ -497,6 +510,7 @@ public function getBalance() * Get messages from an inbox - The ID can ge retrieved from getInboxes() * @param $inbox * @return array|bool|mixed + * @throws Exception */ public function getMessages($inbox) { @@ -509,6 +523,7 @@ public function getMessages($inbox) * Cancel a scheduled message based on a message ID from getScheduledMessages() * @param $id * @return array|bool|mixed + * @throws Exception */ public function cancelScheduledMessage($id) { @@ -520,6 +535,7 @@ public function cancelScheduledMessage($id) /** * Get Scheduled Message information * @return array|mixed + * @throws Exception */ public function getScheduledMessages() { @@ -531,6 +547,7 @@ public function getScheduledMessages() * @param $number * @param int $groupid * @return array|bool|mixed + * @throws Exception */ public function deleteContact($number, $groupid = 5) { @@ -543,6 +560,7 @@ public function deleteContact($number, $groupid = 5) * Delete a group - Be careful, we can not recover any data deleted by mistake * @param $groupid * @return array|mixed + * @throws Exception */ public function deleteGroup($groupid) { @@ -554,9 +572,10 @@ public function deleteGroup($groupid) * Get single SMS history (single numbers, comma seperated numbers when sending) * @param $start * @param $limit - * @param $min_time Unix timestamp - * @param $max_time Unix timestamp + * @param $min_time + * @param $max_time * @return array|bool|mixed + * @throws Exception */ public function getSingleMessageHistory($start, $limit, $min_time, $max_time) { @@ -568,9 +587,10 @@ public function getSingleMessageHistory($start, $limit, $min_time, $max_time) * @param $type * @param $start * @param $limit - * @param $min_time - * @param $max_time + * @param $min_time - timestamp + * @param $max_time - timestamp * @return array|bool|mixed + * @throws Exception */ private function getHistory($type, $start, $limit, $min_time, $max_time) { @@ -583,9 +603,10 @@ private function getHistory($type, $start, $limit, $min_time, $max_time) * Get API SMS Message history * @param $start * @param $limit - * @param $min_time Unix timestamp - * @param $max_time Unix timestamp + * @param $min_time - timestamp + * @param $max_time - timestamp * @return array|bool|mixed + * @throws Exception */ public function getAPIMessageHistory($start, $limit, $min_time, $max_time) { @@ -596,9 +617,10 @@ public function getAPIMessageHistory($start, $limit, $min_time, $max_time) * Get Email to SMS History * @param $start * @param $limit - * @param $min_time Unix timestamp - * @param $max_time Unix timestamp + * @param $min_time - timestamp + * @param $max_time - timestamp * @return array|bool|mixed + * @throws Exception */ public function getEmailToSMSHistory($start, $limit, $min_time, $max_time) { @@ -609,9 +631,10 @@ public function getEmailToSMSHistory($start, $limit, $min_time, $max_time) * Get group SMS history * @param $start * @param $limit - * @param $min_time Unix timestamp - * @param $max_time Unix timestamp + * @param $min_time - timestamp + * @param $max_time - timestamp * @return array|bool|mixed + * @throws Exception */ public function getGroupMessageHistory($start, $limit, $min_time, $max_time) { @@ -621,6 +644,7 @@ public function getGroupMessageHistory($start, $limit, $min_time, $max_time) /** * Get a list of surveys * @return array|mixed + * @throws Exception */ public function getSurveys() { @@ -628,31 +652,38 @@ public function getSurveys() } /** - * Get a deatils of a survey + * Get a details of a survey + * @param $survey_id - survey id * @return array|mixed + * @throws Exception */ - public function getSurveyDetails() + public function getSurveyDetails($survey_id) { - $options = array('survey_id' => $surveyid); + $options = array('survey_id' => $survey_id); return $this->_sendRequest('get_survey_details'); } /** * Get a the results of a given survey + * @param $survey_id + * @param $start - start date + * @param $end - end date * @return array|mixed + * @throws Exception */ - public function getSurveyResults($surveyid, $start, $end) + public function getSurveyResults($survey_id, $start, $end) { - $options = array('survey_id' => $surveyid, 'start_date' => $start, 'end_date' => $end); + $options = array('survey_id' => $survey_id, 'start_date' => $start, 'end_date' => $end); return $this->_sendRequest('get_surveys', $options); } /** * Get all account optouts * @return array|mixed + * @throws Exception */ - public function getOptouts($time = null) + public function getOptouts() { return $this->_sendRequest('get_optouts'); } diff --git a/src/Textlocal.php b/src/Textlocal.php index 4c2be9d..3e86802 100644 --- a/src/Textlocal.php +++ b/src/Textlocal.php @@ -2,6 +2,18 @@ namespace Rahulreghunath\Textlocal; +use Exception; + +/** + * Textlocal Laravel Wrapper Class + * + * This class is used to interface with Laravel and Textlocal API2 to send messages, manage contacts, retrieve messages from + * inboxes, track message delivery statuses, access history reports + * + * @package Rahulreghunath\Textlocal + * @subpackage API + * @author Rahul Reghunath + */ class Textlocal extends TextLocalOriginal { private $sender; @@ -17,11 +29,10 @@ public function __construct() * @param string $receiver * @param string $sender * @return array|mixed - * @throws \Exception + * @throws Exception */ public function send($message, $receiver, $sender = '') { - $result = $this->sendSms([$receiver], $message, $sender != '' ? $sender : $this->sender); - return $result; + return $this->sendSms([$receiver], $message, $sender != '' ? $sender : $this->sender); } }