Showing 107 of 233 total issues
Method search
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search($params)
{
$query = MediaModel::find();
$query->innerJoinWith([
'mediaAuthor' => function ($query) {
Method actionBulkAction
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionBulkAction()
{
if (Yii::$app->request->post('action') === Post::STATUS_PUBLISH) {
foreach (Yii::$app->request->post('ids', []) as $id) {
$model = $this->findModel($id);
Method search
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search($params, $type, $user = null)
{
$query = PostModel::find();
$query->innerJoinWith(['postAuthor'])->from(['post' => static::tableName()]);
$query->andWhere(['type' => $type]);
Function slugify
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.slugify = function (source, options) {
var $target = this;
var $source = $(source);
var targetIsInput = $target.is('input') || $target.is('textarea');
Function actionAjaxChangeHierarchical
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function actionAjaxChangeHierarchical()
{
if (Yii::$app->request->post('action') === 'addItem') {
$model = new TermRelationship();
$model->load(Yii::$app->request->post());
- 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 search
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search($params, $posttype, $post = null)
{
$query = PostCommentModel::find();
$query->innerJoinWith([
Method actionIndex
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionIndex()
{
/* @var $post \common\models\Post */
$query = Post::find()
Method search
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search($params, $mediaId = null)
{
$query = MediaCommentModel::find();
$query->innerJoinWith([
'commentMedia' => function ($query) {
Method actionCreateMenuItem
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionCreateMenuItem($id)
{
$items = '';
if (Yii::$app->request->post('type') === 'link') {
Method actionCreate
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionCreate($type)
{
$model = new Post();
$postType = $this->findPostType($type);
$model->comment_status = Option::get('default_comment_status');
Method behaviors
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
Function actionIndex
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function actionIndex()
{
/* @var $post \common\models\Post */
$query = Post::find()
- 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 actionView
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function actionView($id = null, $slug = null)
{
$render = 'view';
$comment = new Comment();
- 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 actionBulkAction
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function actionBulkAction()
{
if (Yii::$app->request->post('action') === 'active') {
foreach (Yii::$app->request->post('ids', []) as $id) {
$this->findModel($id)->updateAttributes(['status' => Module::STATUS_ACTIVE]);
- 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 actionView
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function actionView($id = null, $slug = null)
{
$render = 'view';
$comment = new Comment();
- 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 actionAjaxCreateHierarchical
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function actionAjaxCreateHierarchical()
{
$item = '';
$term = new Term();
$termRelationship = new TermRelationship();
- 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 up
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
Function post
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function post($printResponse = self::PRINT_RESPONSE)
{
if (Yii::$app->request->get('delete') && $id = Yii::$app->request->get('id')) {
return $this->delete($id, $printResponse);
}
- 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 actionBulkAction
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionBulkAction()
{
if (Yii::$app->request->post('action') === 'active') {
foreach (Yii::$app->request->post('ids', []) as $id) {
$model = $this->findModel($id);
Method behaviors
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),