From ed6008ef3701e4317bb0b5a12bd080d9c5dba12f Mon Sep 17 00:00:00 2001 From: Laetitia Fesselier Date: Thu, 9 Jul 2020 11:13:00 -0400 Subject: [PATCH] [Tools] Enable PHPCS for populate_visit_windows.php (#6793) Co-authored-by: John Saigle Replaces #5995 --- test/run-php-linter.sh | 1 + tools/populate_visit_windows.php | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/run-php-linter.sh b/test/run-php-linter.sh index 9e72c2350ff..8d5974a7eb5 100755 --- a/test/run-php-linter.sh +++ b/test/run-php-linter.sh @@ -41,6 +41,7 @@ declare -a tools_list=( 'single_use/Convert_LorisMenuID_to_ModuleID.php' 'generate_tables_sql.php' 'lorisform_parser.php' + 'populate_visit_windows.php' ) # And on all PHP files in this array diff --git a/tools/populate_visit_windows.php b/tools/populate_visit_windows.php index 6467c9f47ba..854bb33493b 100755 --- a/tools/populate_visit_windows.php +++ b/tools/populate_visit_windows.php @@ -48,7 +48,7 @@ class VisitWindowPopulator */ function __construct() { - $this->DB = Database::singleton(); + $this->DB = Database::singleton(); $this->Config = NDB_Config::singleton(); } @@ -64,13 +64,13 @@ function insertIfMissing($visit) { $verify = $this->DB->pselectOne( "SELECT 'x' FROM Visit_Windows WHERE Visit_label=:VL", - array('VL' => $visit) + ['VL' => $visit] ); if ($verify === 'x') { return; } print "Inserting $visit\n"; - $x = $this->DB->insert("Visit_Windows", array('Visit_label' => $visit)); + $x = $this->DB->insert("Visit_Windows", ['Visit_label' => $visit]); } /** @@ -83,13 +83,13 @@ function run() // Can't use Utility::getVisits() because that uses the Visit_Window table.. $vls = $this->Config->getSetting("visitLabel"); foreach (Utility::associativeToNumericArray($vls) as $visits) { - foreach (Utility::associativeToNumericArray($visits['labelSet']['item']) as $item) { + foreach (Utility::associativeToNumericArray( + $visits['labelSet']['item'] + ) as $item) { $visit = $item['@']['value']; if (!empty($visit)) { $this->insertIfMissing($visit); } - - }; } }