Showing 107 of 233 total issues
User
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class User extends ActiveRecord implements IdentityInterface
{
const STATUS_REMOVED = 0;
const STATUS_NOT_ACTIVE = 5;
const STATUS_ACTIVE = 10;
Post
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Post extends ActiveRecord
{
public $username;
const COMMENT_STATUS_OPEN = 'open';
Method up
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
Function actionBulkAction
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function actionBulkAction()
{
if (Yii::$app->request->post('action') === MediaComment::STATUS_APPROVED) {
foreach (Yii::$app->request->post('ids', []) as $id) {
$this->findModel($id)->updateAttributes(['status' => MediaComment::STATUS_APPROVED]);
- 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 19 (exceeds 5 allowed). Consider refactoring. Open
public function actionBulkAction()
{
if (Yii::$app->request->post('action') === PostComment::STATUS_APPROVED) {
foreach (Yii::$app->request->post('ids', []) as $id) {
$this->findModel($id)->updateAttributes(['status' => PostComment::STATUS_APPROVED]);
- 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 init
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function()
{
var list = this;
list.reset();
Method actionCreate
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionCreate()
{
$errors = [];
$model = new Widget(['scenario' => 'upload']);
Method up
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
Method createScaledImage
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function createScaledImage($fileName, $version, $options)
{
$success = false;
$filePath = $this->getFilePath($fileName);
$image = Image::getImagine()->open($filePath);
Function createScaledImage
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function createScaledImage($fileName, $version, $options)
{
$success = false;
$filePath = $this->getFilePath($fileName);
$image = Image::getImagine()->open($filePath);
- 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
File Post.php
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @link http://www.writesdown.com/
* @copyright Copyright (c) 2015 WritesDown
* @license http://www.writesdown.com/license/
File discussion.php
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @link http://www.writesdown.com/
* @author Agiel K. Saputra <13nightevil@gmail.com>
* @copyright Copyright (c) 2015 WritesDown
Function setModule
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function setModule($app)
{
foreach (Module::getActiveModules() as $module) {
// Get module backend config.
if ($config = $module->getFrontendConfig()) {
- 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 setModule
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function setModule($app)
{
foreach (Module::getActiveModules() as $module) {
// Get module backend config.
if ($config = $module->getBackendConfig()) {
- 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 actionUpload
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionUpload()
{
$errors = [];
$model = new DynamicModel(['file']);
$model->addRule(['file'], 'required')
Method displayComment
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function displayComment($comment, $depth = 0)
{
echo Html::beginTag('div', [
'id' => 'comment-' . $comment->id,
'class' => $comment->child ? 'parent depth-' . $depth : 'depth-' . $depth,
Function MediaModal
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
var MediaModal = function (button, options) {
this.button = $(button);
this.settings = $.extend({
url: 'index.php?media-browser/index',
Function actionBulkAction
has a Cognitive Complexity of 15 (exceeds 5 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);
- 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 setOptions
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setOptions($options = [])
{
$this->options = [
'script_url' => Yii::$app->request->absoluteUrl,
'upload_dir' => Yii::getAlias('@public/uploads/'),
Function actionUpload
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.actionUpload = function () {
this.upload.fileupload({
url: this.settings.url.upload,
dropZone: this.dropzone,
autoUpload: true,