diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php index 3ad6387..91caeb1 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php @@ -573,56 +573,56 @@ class PullsModel extends AbstractModel foreach ($pulls as $pull) { - // Check if this PR is RTC and has a `PR-` branch label - $isRTC = false; - $isNPM = false; - $branch = ''; + // Check if this PR is RTC and has a `PR-` branch label + $isRTC = false; + $isNPM = false; + $branch = ''; - foreach ($pull->labels as $label) + foreach ($pull->labels as $label) + { + if (strtolower($label->name) === 'rtc') { - if (strtolower($label->name) === 'rtc') - { - $isRTC = true; - } - elseif (strpos($label->name, 'PR-') === 0) - { - $branch = substr($label->name, 3); - } - elseif (in_array( - strtolower($label->name), - ['npm resource changed', 'composer dependency changed'], - true - )) - { - $isNPM = true; - } - - $labels[] = implode( - ',', - [ - (int) $pull->number, - $this->getDb()->quote($label->name), - $this->getDb()->quote($label->color), - ] - ); + $isRTC = true; + } + elseif (strpos($label->name, 'PR-') === 0) + { + $branch = substr($label->name, 3); + } + elseif (in_array( + strtolower($label->name), + ['npm resource changed', 'composer dependency changed'], + true + )) + { + $isNPM = true; } - // Build the data object to store in the database - $pullData = [ - (int) $pull->number, - $this->getDb()->quote( - HTMLHelper::_('string.truncate', $pull->title, 150) - ), - $this->getDb()->quote( - HTMLHelper::_('string.truncate', $pull->body, 100) - ), - $this->getDb()->quote($pull->html_url), - (int) $isRTC, - (int) $isNPM, - $this->getDb()->quote($branch), - ]; + $labels[] = implode( + ',', + [ + (int) $pull->number, + $this->getDb()->quote($label->name), + $this->getDb()->quote($label->color), + ] + ); + } - $data[] = implode(',', $pullData); + // Build the data object to store in the database + $pullData = [ + (int) $pull->number, + $this->getDb()->quote( + HTMLHelper::_('string.truncate', $pull->title, 150) + ), + $this->getDb()->quote( + HTMLHelper::_('string.truncate', $pull->body, 100) + ), + $this->getDb()->quote($pull->html_url), + (int) $isRTC, + (int) $isNPM, + $this->getDb()->quote($branch), + ]; + + $data[] = implode(',', $pullData); } // If there are no pulls to insert then bail, assume we're finished