rename all instances of 'datas' to 'data'

This commit is contained in:
osaajani 2021-01-17 03:16:57 +01:00
parent 730ac8963b
commit 61d644c247
48 changed files with 316 additions and 316 deletions

View file

@ -22,9 +22,9 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
const SMS_TYPE_INTERNATIONAL = 'WWW';
/**
* Datas used to configure interaction with the implemented service. (e.g : Api credentials, ports numbers, etc.).
* Data used to configure interaction with the implemented service. (e.g : Api credentials, ports numbers, etc.).
*/
private $datas;
private $data;
/**
* Octopush login.
@ -55,16 +55,16 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
* Adapter constructor, called when instanciated by RaspiSMS.
*
* @param string $number : Phone number the adapter is used for
* @param json string $datas : JSON string of the datas to configure interaction with the implemented service
* @param json string $data : JSON string of the data to configure interaction with the implemented service
*/
public function __construct(string $datas)
public function __construct(string $data)
{
$this->datas = json_decode($datas, true);
$this->data = json_decode($data, true);
$this->login = $this->datas['login'];
$this->api_key = $this->datas['api_key'];
$this->number = $this->datas['number'];
$this->formatted_number = '+' . mb_substr($this->datas['number'], 2);
$this->login = $this->data['login'];
$this->api_key = $this->data['api_key'];
$this->number = $this->data['number'];
$this->formatted_number = '+' . mb_substr($this->data['number'], 2);
}
/**
@ -108,11 +108,11 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
}
/**
* List of entries we want in datas for the adapter.
* List of entries we want in data for the adapter.
*
* @return array : Every line is a field as an array with keys : name, title, description, required
*/
public static function meta_datas_fields(): array
public static function meta_data_fields(): array
{
return [
[
@ -192,7 +192,7 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
try
{
$datas = [
$data = [
'user_login' => $this->login,
'api_key' => $this->api_key,
'sms_text' => $text,
@ -208,7 +208,7 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $datas);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($curl);
curl_close($curl);
@ -285,12 +285,12 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
{
$success = true;
if ($this->datas['sender'] && (mb_strlen($this->datas['sender']) < 3 || mb_strlen($this->datas['sender'] > 11)))
if ($this->data['sender'] && (mb_strlen($this->data['sender']) < 3 || mb_strlen($this->data['sender'] > 11)))
{
return false;
}
$datas = [
$data = [
'user_login' => $this->login,
'api_key' => $this->api_key,
];
@ -302,7 +302,7 @@ class OctopushVirtualNumberAdapter implements AdapterInterface
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $datas);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($curl);
curl_close($curl);