Showing 223 of 419 total issues
Consider simplifying this complex logical expression. Open
if (is_numeric($this->categoryId) && $this->categoryId >= 1
&& is_numeric($this->forumId) && $this->forumId >= 1
&& is_numeric($this->threadId) && $this->threadId >= 1
&& !empty($this->threadSlug)) {
return true;
Function actionImport
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function actionImport()
{
$result = ['error' => Yii::t('podium/view', 'Error')];
if (Yii::$app->request->isPost) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function actionIgnore
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function actionIgnore($id = null)
{
if (Podium::getInstance()->user->isGuest) {
return $this->redirect(['forum/index']);
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function can
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function can($permissionName, $params = [], $allowCaching = true)
{
if (Podium::getInstance()->userComponent === true) {
return Podium::getInstance()->user->can($permissionName, $params, $allowCaching);
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function actionMark
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function actionMark($id = null)
{
$model = Subscription::find()->where(['id' => $id, 'user_id' => User::loggedId()])->limit(1)->one();
if (empty($model)) {
$this->error(Yii::t('podium/flash', 'Sorry! We can not find Subscription with this ID.'));
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function actionRegister
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function actionRegister()
{
if ($this->module->userComponent !== true) {
$this->info(Yii::t('podium/flash', "Please use application's Register form to sign up."));
return $this->module->goPodium();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function actionDelete
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function actionDelete($cid = null, $fid = null, $id = null, $slug = null)
{
$thread = (new ThreadVerifier([
'categoryId' => $cid,
'forumId' => $fid,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function actionContents
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function actionContents($name = '')
{
if (empty($name)) {
$name = Content::TERMS_AND_CONDS;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function nextDrop
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function nextDrop()
{
$drops = $this->countDrops();
if (count($drops)) {
$currentStep = Yii::$app->session->get(self::SESSION_KEY, 0);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function add
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function add()
{
try {
$ip = Yii::$app->request->userIp;
$url = Yii::$app->request->url;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function requiredPollAnswers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function requiredPollAnswers()
{
if ($this->pollAdded) {
$this->pollAnswers = array_unique($this->pollAnswers);
$filtered = [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function addNewWords
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function addNewWords($allWords)
{
try {
$newWords = $allWords;
$query = (new Query())->from(Vocabulary::tableName())->where(['word' => $allWords]);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if (!$model->image->saveAs($path . DIRECTORY_SEPARATOR . $model->avatar)) {
Log::error('Error while saving avatar image', null, __METHOD__);
$this->error(Yii::t('podium/flash', 'Sorry! There was an error while uploading the avatar image. Contact administrator about this problem.'));
}
Function actionFriend
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function actionFriend($id = null)
{
if (Podium::getInstance()->user->isGuest) {
return $this->redirect(['forum/index']);
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function searchTopics
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function searchTopics()
{
$query = Thread::find();
if (Podium::getInstance()->user->isGuest) {
$query->joinWith(['forum' => function ($q) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if (!FileHelper::createDirectory($path)) {
$folderExists = false;
Log::error('Error while creating avatars folder', null, __METHOD__);
$this->error(Yii::t('podium/flash', 'Sorry! There was an error while creating the avatars folder. Contact administrator about this problem.'));
}
Avoid deeply nested control flow statements. Open
if (!empty($model->avatar) && file_exists($oldAvatarPath)) {
if (!unlink($oldAvatarPath)) {
Log::error('Error while deleting old avatar image', null, __METHOD__);
}
}
Function vote
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function vote($userId, $answers)
{
$votes = [];
$time = time();
foreach ($answers as $answer) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function addInheritedAdmin
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function addInheritedAdmin()
{
if (empty($this->module->adminId)) {
$this->type = self::TYPE_WARNING;
return Yii::t('podium/flash', 'No administrator privileges have been set!');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function emailCheck
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function emailCheck($warnings)
{
if ($warnings) {
foreach ($warnings as $warning) {
if ($warning === static::warnings()['email']) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"