feat: install phpstan and resolving reported errors in PHPStan

This commit is contained in:
amir-ys
2024-11-07 01:41:19 +03:30
parent b7efa6b24a
commit 865d565a91
27 changed files with 1023 additions and 642 deletions
+23 -20
View File
@@ -4,55 +4,58 @@ namespace Packages\SMSSender;
class SMSSender
{
private $userName = null;
private $password = null;
private $webService = null;
private $fromNumber = null;
private $userName = null;
private $password = null;
private $webService = null;
private $fromNumber = null;
private static $panel = null;
private function __construct() { }
private function __construct()
{
}
public static function instance() {
public static function instance()
{
if (static::$panel === null) {
static::$panel = new static();
static::$panel = new self();
}
return static::$panel;
}
public function setUserName ($userName)
public function setUserName($userName)
{
$this->userName = $userName;
return $this;
}
public function setPassword ($password)
public function setPassword($password)
{
$this->password = $password;
return $this;
}
public function setWebService ($webService)
public function setWebService($webService)
{
$this->webService = $webService;
return $this;
}
public function getUserName ()
public function getUserName()
{
return ($this->userName) ? $this->userName : env('SMS_USERNAME', '');
}
public function getPassword ()
public function getPassword()
{
return ($this->password) ? $this->password : env('SMS_PASSWORD', '');
}
public function getFromNumber ()
public function getFromNumber()
{
return ($this->fromNumber) ? $this->fromNumber : env('SMS_FROM_NUMBER', '');
}
public function getWebService ()
public function getWebService()
{
return ($this->webService) ? $this->webService : env('SMS_WEBSERVICE', '');
}
@@ -64,8 +67,8 @@ class SMSSender
}
try {
$user = $this->getUserName();
$pass = $this->getPassword();
$fromNum = $this->getFromNumber();
$pass = $this->getPassword();
$fromNum = $this->getFromNumber();
$client = new \SoapClient($this->getWebService());
$client->sendPatternSms($fromNum, $cellNumber, $user, $pass, $pattern_code, $input_data);
@@ -84,11 +87,11 @@ class SMSSender
ini_set("soap.wsdl_cache_enabled", "0");
try {
$user = $this->getUserName();
$pass = $this->getPassword();
$fromNum = $this->getFromNumber();
$pass = $this->getPassword();
$fromNum = $this->getFromNumber();
//If you want to send in the future ==> $time = '2016-07-30' //$time = '2016-07-30 12:50:50'
$client = new \SoapClient($this->getWebService());
$client->SendSMS($fromNum, $cellNumber, $messageContent, $user, $pass, '', 'send');
$client = new \SoapClient($this->getWebService());
$client->SendSMS($fromNum, $cellNumber, $messageContent, $user, $pass, '', 'send');
return true;
} catch (\SoapFault $sf) {
print $sf->faultcode . "\n";