]> git.mxchange.org Git - mailer.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 26 Dec 2024 02:28:44 +0000 (03:28 +0100)
committerRoland Häder <roland@mxchange.org>
Thu, 26 Dec 2024 02:36:48 +0000 (03:36 +0100)
- added more 'array' type-hints

inc/classes/cachesystem.class.php
inc/general-functions.php

index d931838d6608b662a0836d7a027356b17166a456..98bbcdeac61c18f85aee5df19a7f8ff46253a1a5 100644 (file)
@@ -151,7 +151,7 @@ class CacheSystem {
        }
 
        // Adds a data row (array) to cache file and global cache array
-       function addRow ($data) {
+       function addRow (array $data) {
                // Is the pointe rvalid?
                if (is_resource($this->pointer)) {
                        // Write every array element to cache file
@@ -359,7 +359,7 @@ class CacheSystem {
        }
 
        // Unused method:
-       function removeEntry ($search, $data, $array) {
+       function removeEntry ($search, array $data, array $array) {
                if ($this->status[$this->name] == 'done') {
                        // Load cache into dummy array
                        $dummy = $this->getArrayFromCache();
@@ -388,23 +388,23 @@ class CacheSystem {
                }
        }
 
-       function writeArray ($array) {
+       function writeArray (array $array) {
                if (is_resource($this->pointer)) {
-                       foreach ($array as $k => $v) {
-                               if (is_array($v)) {
+                       foreach ($array as $key => $value) {
+                               if (is_array($value)) {
                                        // Multi line(s) found
-                                       $LINE = '';
-                                       foreach ($v as $k2 => $v2) {
+                                       $line = '';
+                                       foreach ($value as $key2 => $value2) {
                                                // Put every array element in a row...
-                                               $LINE .= $this->rewriteEntry($k, $v2);
+                                               $line .= $this->rewriteEntry($key, $value2);
                                        } // END - foreach
                                } else {
                                        // Single line found
-                                       $LINE = $this->rewriteEntry($k, $v);
+                                       $line = $this->rewriteEntry($key, $value);
                                }
 
                                // Write line(s)
-                               $this->writeLine($LINE);
+                               $this->writeLine($line);
                        } // END - foreach
                } else {
                        // Cannot write array!
@@ -413,7 +413,7 @@ class CacheSystem {
        }
 
        // Unused method
-       function replaceEntry ($search, $replace, $search_key, $array) {
+       function replaceEntry ($search, $replace, $search_key, array $array) {
                if ($this->status[$this->name] == 'done') {
                        // Load cache into dummy array
                        $dummy = $this->getArrayFromCache();
@@ -425,7 +425,7 @@ class CacheSystem {
                                if ($key_found == TRUE) {
                                        $key = $search_key;
                                        // Key (hopefully) found?
-                                       foreach ($dummy as $a => $v) {
+                                       foreach ($dummy as $a => $value) {
                                                // So we can update all entries
                                                if ($a == $search) {
                                                        // Update now...
index e962e0c6271582e9564e4b1d371d1940b35c7cf6..8508acc6c13414e3045db9f1a8aab7a6a68ce55b 100644 (file)
@@ -98,7 +98,7 @@ function initApplication ($path) {
 function loadLibraries () {
        // Init arrays
        $__functions = [];
-       $__libs = array(
+       $__libs = [
                'stats',
                'xml',
                'callback',
@@ -117,7 +117,7 @@ function loadLibraries () {
                'database',
                'error',
                'math',
-       );
+       ];
 
        // Init include file array as it follows same naming scheme
        foreach ($__libs as $lib) {
@@ -126,7 +126,7 @@ function loadLibraries () {
        } // END - foreach
 
        // Add more libs (let's get rid of them slowly)
-       foreach (array('filters') as $lib) {
+       foreach (['filters'] as $lib) {
                // Add it
                array_push($__functions, $lib);
        } // END - foreach
@@ -2574,7 +2574,7 @@ function removeDoubleDotFromSubject ($subject) {
 }
 
 // Adds a given entry to the database
-function memberAddEntries ($tableName, $columns = [], $filterFunctions = [], $extraValues = [], $timeColumns = [], $columnIndex = NULL) {
+function memberAddEntries ($tableName, array $columns = [], array $filterFunctions = [], array $extraValues = [], array $timeColumns = [], $columnIndex = NULL) {
        // Is it a member?
        if (!isMember()) {
                // Then abort here
@@ -2598,7 +2598,7 @@ function memberAddEntries ($tableName, $columns = [], $filterFunctions = [], $ex
 }
 
 // Edit rows by given id numbers
-function memberEditEntriesConfirm ($tableName, $columns = [], $filterFunctions = [], $extraValues = [], $timeColumns = [], $editNow = array(FALSE), $idColumn = array('id'), $userIdColumn = array('userid'), $rawUserId = array('userid'), $cacheFiles = [], $content = []) {
+function memberEditEntriesConfirm ($tableName, array $columns = [], array $filterFunctions = [], array $extraValues = [], array $timeColumns = [], array $editNow = [FALSE], array $idColumn = ['id'], array $userIdColumn = ['userid'], array $rawUserId = ['userid'], array $cacheFiles = [], array $content = []) {
        // $tableName must be an array
        if ((!is_array($tableName)) || (count($tableName) != 1)) {
                // No tableName specified
@@ -2637,7 +2637,7 @@ function memberEditEntriesConfirm ($tableName, $columns = [], $filterFunctions =
 }
 
 // Delete rows by given id numbers
-function memberDeleteEntriesConfirm ($tableName, $columns = [], $filterFunctions = [], $extraValues = [], $deleteNow = array(FALSE), $idColumn = array('id'), $userIdColumn = array('userid'), $rawUserId = array('userid'), $cacheFiles = [], $content = []) {
+function memberDeleteEntriesConfirm ($tableName, array $columns = [], array $filterFunctions = [], array $extraValues = [], array $deleteNow = [FALSE], array $idColumn = ['id'], array $userIdColumn = ['userid'], array $rawUserId = ['userid'], array $cacheFiles = [], array $content = []) {
        // Do this only for members
        assert(isMember());
 
@@ -2758,7 +2758,7 @@ function caluculateTimeUnitValue ($seconds, $timeUnit) {
 }
 
 // "Getter" for an array from given one but only one index of it
-function getArrayFromArrayIndex ($array, $key) {
+function getArrayFromArrayIndex (array $array, $key) {
        // Some simple validation
        assert(isset($array[0][$key]));