Skip to content

Commit

Permalink
[Tools] Enable PHPCS for populate_visit_windows.php (aces#6793)
Browse files Browse the repository at this point in the history
Co-authored-by: John Saigle <[email protected]>

Replaces aces#5995
  • Loading branch information
laemtl committed Jul 9, 2020
1 parent 200d3d9 commit c4c2c1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions test/run-php-linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions tools/populate_visit_windows.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class VisitWindowPopulator
*/
function __construct()
{
$this->DB = Database::singleton();
$this->DB = Database::singleton();
$this->Config = NDB_Config::singleton();
}

Expand All @@ -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]);
}

/**
Expand All @@ -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);
}


};
}
}
Expand Down

0 comments on commit c4c2c1a

Please sign in to comment.