44use Technitium \DNSServer \API \Helper \Log ;
55
66class DDNS {
7- private $ API ;
7+ private \ Technitium \ DNSServer \ API \ API $ API ;
88
9- public function __construct ($ api , $ configFile = null ){
9+ public function __construct (\ Technitium \ DNSServer \ API \ API $ api , string $ configFile = null ){
1010 $ this ->API = $ api ;
1111 if ($ configFile != null ) {
1212 $ this ->updateRecords ($ configFile );
@@ -15,10 +15,10 @@ public function __construct($api, $configFile = null){
1515
1616 /**
1717 * `getPublicIP()` function is used to get the public IP address of the server.
18- * @param mixed $uri The URI to get the public IP address from. Currently, it is set to "https://ipecho.net/plain".
18+ * @param string $uri The URI to get the public IP address from. Currently, it is set to "https://ipecho.net/plain".
1919 * @return string The public IP address of the server.
2020 */
21- public function getPublicIP ($ uri = "https://ipecho.net/plain " ) {
21+ public function getPublicIP (string $ uri = "https://ipecho.net/plain " ) {
2222 return trim (file_get_contents ($ uri ));
2323 }
2424
@@ -41,11 +41,11 @@ public function updateRecords(string $configFile) {
4141
4242 /**
4343 * `processRecord()` function is used to process the record.
44- * @param mixed $record The record to be processed.
45- * @param mixed $domain The domain the record belongs to.
44+ * @param string $record The record to be processed.
45+ * @param string $domain The domain the record belongs to.
4646 * @return void Either adds or updates the record.
4747 */
48- private function processRecord ($ record , $ domain ) {
48+ private function processRecord (string $ record , string $ domain ) {
4949 try {
5050 $ allrecords = $ this ->API ->zones ()->records ()->get ($ record )["records " ];
5151 } catch (\Throwable $ th ) {
@@ -77,12 +77,12 @@ private function processRecord($record, $domain) {
7777
7878 /**
7979 * `updateRecord()` function is used to update the record.
80- * @param mixed $record The record to be updated.
81- * @param mixed $domain The domain the record belongs to.
82- * @param mixed $newIP The new IP address to be used.
80+ * @param string $record The record to be updated.
81+ * @param string $domain The domain the record belongs to.
82+ * @param string $newIP The new IP address to be used.
8383 * @return void Updates the record.
8484 */
85- private function updateRecord ($ record , $ domain , $ newIP ) {
85+ private function updateRecord (string $ record , string $ domain , string $ newIP ) {
8686 if (!$ this ->API ->zones ()->records ()->update ([
8787 "domain " => $ record ,
8888 "type " => "A " ,
@@ -97,12 +97,12 @@ private function updateRecord($record, $domain, $newIP) {
9797
9898 /**
9999 * `addRecord()` function is used to add the record.
100- * @param mixed $record The record to be added.
101- * @param mixed $domain The domain the record belongs to.
102- * @param mixed $ipAddress The IP address to be used.
100+ * @param string $record The record to be added.
101+ * @param string $domain The domain the record belongs to.
102+ * @param string $ipAddress The IP address to be used.
103103 * @return void Adds the record.
104104 */
105- private function addRecord ($ record , $ domain , $ ipAddress ) {
105+ private function addRecord (string $ record , string $ domain , string $ ipAddress ) {
106106 if (!$ this ->API ->zones ()->records ()->add ([
107107 "domain " => $ record ,
108108 "type " => "A " ,
0 commit comments