tesark /
msg91-php
| 1 | <?php |
||||
| 2 | namespace Sender\Traits; |
||||
| 3 | |||||
| 4 | use Sender\Validation; |
||||
| 5 | use Sender\MobileNumber; |
||||
| 6 | use Sender\Otp\OtpBuildClass; |
||||
| 7 | use Sender\Otp\OtpDefineClass; |
||||
| 8 | use Sender\ExceptionClass\ParameterException; |
||||
| 9 | |||||
| 10 | /** |
||||
| 11 | * This trait for OTP FUNCTIONS |
||||
| 12 | * |
||||
| 13 | * @package Msg91 SMS&OTP package |
||||
| 14 | * @author VenkatS <[email protected]> |
||||
| 15 | * @link https://github.com/tesark/msg91-php |
||||
| 16 | * @license MIT |
||||
| 17 | */ |
||||
| 18 | |||||
| 19 | trait OtpBuildTrait |
||||
| 20 | { |
||||
| 21 | /** |
||||
| 22 | * Check Authkey and mobile |
||||
| 23 | * @param string $parameter |
||||
| 24 | * |
||||
| 25 | * @throws ParameterException missing parameters or return empty |
||||
| 26 | * @return bool |
||||
| 27 | */ |
||||
| 28 | 20 | public function isParameterPresent($parameter) |
|||
| 29 | { |
||||
| 30 | 20 | if ($this->isKeyExists($parameter, $this->sendData)) { |
|||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
It seems like
isKeyExists() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 31 | 20 | if ($parameter === 'authkey') { |
|||
| 32 | 20 | return $this->hasAuthKey($parameter); |
|||
|
0 ignored issues
–
show
It seems like
hasAuthKey() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 33 | } else { |
||||
| 34 | 20 | return $this->hasMobile($parameter); |
|||
|
0 ignored issues
–
show
It seems like
hasMobile() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 35 | } |
||||
| 36 | } else { |
||||
| 37 | $message = "Parameter ".$parameter." missing"; |
||||
| 38 | throw ParameterException::missinglogic($message); |
||||
| 39 | } |
||||
| 40 | } |
||||
| 41 | /** |
||||
| 42 | * Check Authkey |
||||
| 43 | * |
||||
| 44 | * @return bool |
||||
| 45 | */ |
||||
| 46 | 20 | public function checkAuthKey() |
|||
| 47 | { |
||||
| 48 | 20 | return $this->isParameterPresent('authkey'); |
|||
| 49 | } |
||||
| 50 | /** |
||||
| 51 | * Check mobile |
||||
| 52 | * |
||||
| 53 | * @return bool |
||||
| 54 | */ |
||||
| 55 | 20 | public function checkMobile() |
|||
| 56 | { |
||||
| 57 | 20 | return $this->isParameterPresent('mobile'); |
|||
| 58 | } |
||||
| 59 | } |
||||
| 60 |