Showing 107 of 233 total issues
Method actionIndex
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionIndex($id = null, $slug = null)
{
$render = 'index';
if ($id) {
Method actionView
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionView($id = null, $user = null)
{
$render = '/user/view';
if ($id) {
Method up
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
Method actionView
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionView($id = null, $slug = null)
{
$render = 'view';
$comment = new Comment();
Method post
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
}
Method search
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function search($params)
{
$query = UserModel::find();
$query->andWhere(['<>', 'id', Yii::$app->user->id]);
Method beforeAction
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function beforeAction($action)
{
/* @var $postType \common\models\PostType */
/* @var $taxonomy \common\models\Taxonomy */
if (parent::beforeAction($action)) {
Method actionIndex
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionIndex()
{
$config = [];
$active = [];
$available = [];
Method behaviors
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
Method run
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function run()
{
echo $this->beforeWidget;
if ($this->title) {
Method getMediaImage
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getMediaImage($media)
{
$result = '';
$model = $this->findModel(ArrayHelper::getValue($media, 'id'));
$meta = $model->getMeta('metadata');
Method actionView
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionView($id = null, $slug = null)
{
$render = 'view';
if ($id) {
Method beforeSave
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function beforeSave($insert)
{
if (parent::beforeSave($insert)) {
if ($this->isNewRecord) {
if (!Yii::$app->user->isGuest) {
Function saveMenuItem
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function saveMenuItem($menuOrder, $menuParent = 0)
{
foreach ($menuOrder as $key => $order) {
$menuItem = Yii::$app->request->post('MenuItem')[$order['id']];
if ($model = $this->findMenuItem($order['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 actionUpdate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
public function actionUpdate($id)
{
$model = $this->findModel($id);
$this->getPermission($model);
$postType = $model->postType;
- 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 dragStart
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
dragStart: function(e)
{
var mouse = this.mouse,
target = $(e.target),
dragItem = target.closest(this.options.itemNodeName);
Method actionView
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function actionView($id = null, $slug = null)
{
$render = 'view';
$comment = new Comment();
Function reset
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
reset: function()
{
this.mouse = {
offsetX : 0,
offsetY : 0,
Method getTaxonomyMenus
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected static function getTaxonomyMenus($postType)
{
$items = [];
$items[] = [
'icon' => 'fa fa-circle-o',
Method behaviors
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function behaviors()
{
return [
'access' => [