Showing 48 of 1,384 total issues
Function actionFollowRefresh
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function actionFollowRefresh()
{
Follow::deleteAll(['status' => [self::USER_STATUS_TEST_ACTIVE, self::USER_STATUS_TEST_INACTIVE]]);
$users = User::find()->active(self::USER_STATUS_TEST_ACTIVE)->all();
/* @var $users User[] */
- 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 run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function run($response_type = null, $client_id = null, $state = null, $redirect_uri = null, $scope = null)
{
// log user in forcely before validate.
$checkResult = $this->checkResponseType($response_type);
if ($checkResult !== true) {
- 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 notifyOthers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function notifyOthers($event)
{
// Only logged-in user can send notification.
if (Yii::$app->user->isGuest) {
return false;
- 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 generateUserInfo
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function generateUserInfo($nickname = null, $first_name = null, $last_name = null, $gender = null, $phone = null, $email = null, $password = null)
{
if (empty($gender)) {
$gender = $this->faker->numberBetween() % 2;
}
- 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
Method behaviors
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
Method generateUserInfo
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateUserInfo($nickname = null, $first_name = null, $last_name = null, $gender = null, $phone = null, $email = null, $password = null)
{
if (empty($gender)) {
$gender = $this->faker->numberBetween() % 2;
}
Method actionIndex
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionIndex($id)
{
$user = null;
if (preg_match(Number::GUID_REGEX, $id)) {
$user = User::find()->guid($id)->one();
Function getRateLimit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getRateLimit($request, $action)
{
$allow = 10;
$window = 600;
$route = $action->controller->route;
- 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
Method generateUserInfo
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
private function generateUserInfo($nickname = null, $first_name = null, $last_name = null, $gender = null, $phone = null, $email = null, $password = null)
Function post
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
post: function (url, parameters, successCallback, failCallback, postFailCallback, postAlwaysCallback) {
Function address
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
rho.my.address = (function ($) {
var pub = {
/**
* selector: REQUIRED.
* url: REQUIRED.
- 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
Method run
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function run($response_type = null, $client_id = null, $state = null, $redirect_uri = null, $scope = null)
Function actionNew
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function actionNew()
{
if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
return $this->actionValidate();
}
- 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 actionNew
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function actionNew()
{
if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
return $this->actionValidate();
}
- 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 actionNew
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function actionNew()
{
if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
return $this->actionValidate();
}
- 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 actionNew
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function actionNew()
{
if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
return $this->actionValidate();
}
- 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 actionFollowingPhones
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function actionFollowingPhones($id)
{
$user = User::find()->id($id)->one();
if (!$user) {
throw new Exception("User $id not found.");
- 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 actionNew
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function actionNew()
{
if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
return $this->actionValidate();
}
- 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 actionNew
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function actionNew()
{
if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
return $this->actionValidate();
}
- 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 too many return
statements within this method. Open
return $region . " " . $district->localname;