Commit 4234de91 by Scott

Coding style (strict): control braces

parent 7c6b6de0
......@@ -70,10 +70,11 @@ class UserPosts extends \Q2A\Controllers\BaseController
$qa_content = qa_content_prepare(true);
if (count($questions))
if (count($questions)) {
$qa_content['title'] = qa_lang_html_sub('profile/recent_activity_by_x', $this->userhtml);
else
} else {
$qa_content['title'] = qa_lang_html_sub('profile/no_posts_by_x', $this->userhtml);
}
// Recent activity by this user
......@@ -154,10 +155,11 @@ class UserPosts extends \Q2A\Controllers\BaseController
$qa_content = qa_content_prepare(true);
if (count($questions))
if (count($questions)) {
$qa_content['title'] = qa_lang_html_sub('profile/questions_by_x', $this->userhtml);
else
} else {
$qa_content['title'] = qa_lang_html_sub('profile/no_questions_by_x', $this->userhtml);
}
// Recent questions by this user
......@@ -240,10 +242,11 @@ class UserPosts extends \Q2A\Controllers\BaseController
$qa_content = qa_content_prepare(true);
if (count($questions))
if (count($questions)) {
$qa_content['title'] = qa_lang_html_sub('profile/answers_by_x', $this->userhtml);
else
} else {
$qa_content['title'] = qa_lang_html_sub('profile/no_answers_by_x', $this->userhtml);
}
// Recent questions by this user
......@@ -299,7 +302,8 @@ class UserPosts extends \Q2A\Controllers\BaseController
$usershtml = qa_get_users_html(array($this->userid), false, qa_path_to_root(), true);
$this->userhtml = @$usershtml[$this->userid];
} else
} else {
$this->userhtml = qa_html($handle);
}
}
}
......@@ -266,8 +266,9 @@ class DbConnection
if ($cacheDriver->isEnabled()) {
$queryData = $cacheDriver->get($cacheKey);
if ($queryData !== null)
if ($queryData !== null) {
return $queryData;
}
}
}
......@@ -311,8 +312,9 @@ class DbConnection
if (!QA_OPTIMIZE_DISTANT_DB || count($selectspecs) <= 1) {
$outresults = array();
foreach ($selectspecs as $selectkey => $selectspec)
foreach ($selectspecs as $selectkey => $selectspec) {
$outresults[$selectkey] = $this->singleSelect($selectspec);
}
return $outresults;
}
......@@ -390,21 +392,24 @@ class DbConnection
$rawresults = $stmt->fetchAllAssoc();
$outresults = array();
foreach ($selectspecs as $selectkey => $selectspec)
foreach ($selectspecs as $selectkey => $selectspec) {
$outresults[$selectkey] = array();
}
foreach ($rawresults as $rawresult) {
$selectkey = $rawresult['selectkey'];
$selectspec = $selectspecs[$selectkey];
$keepresult = array();
foreach ($selectspec['outcolumns'] as $columnas => $columnfrom)
foreach ($selectspec['outcolumns'] as $columnas => $columnfrom) {
$keepresult[$columnas] = $rawresult[$columnas];
}
if (isset($selectspec['arraykey']))
if (isset($selectspec['arraykey'])) {
$outresults[$selectkey][$keepresult[$selectspec['arraykey']]] = $keepresult;
else
} else {
$outresults[$selectkey][] = $keepresult;
}
}
// Post-processing to apply various stuff include sorting request, since we can't rely on ORDER BY due to UNION
......@@ -442,8 +447,9 @@ class DbConnection
qa_sort_by($outresult, $selectspec['sortdesc'], $selectspec['sortdesc_2']);
} else {
$index = count($outresult);
foreach ($outresult as $key => $value)
foreach ($outresult as $key => $value) {
$outresult[$key]['_order_'] = $index--;
}
qa_sort_by($outresult, $selectspec['sortdesc'], '_order_');
}
......
......@@ -40,8 +40,7 @@ class CacheFactory
$driver = qa_opt('caching_driver');
switch($driver)
{
switch ($driver) {
case 'memcached':
self::$cacheDriver = new MemcachedDriver($config);
break;
......
......@@ -13,8 +13,6 @@
<rule ref="PSR2">
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
<exclude name="Generic.Files.LineLength.TooLong"/>
<exclude name="Generic.ControlStructures.InlineControlStructure"/>
<exclude name="Squiz.ControlStructures.ControlSignature"/> <!-- doesn't work without above rule -->
</rule>
<arg name="tab-width" value="4"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment