Skip to content

Commit

Permalink
Merge pull request #24 from humhub-contrib/enh/php-cs-fixer
Browse files Browse the repository at this point in the history
Use PHP CS Fixer
  • Loading branch information
luke- authored Oct 3, 2024
2 parents 59499a9 + 2e862ab commit 645500d
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 38 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: PHP CS Fixer

on: push

jobs:
fixers:
uses: humhub/actions/.github/workflows/module-php-cs-fixer.yml@main
3 changes: 1 addition & 2 deletions Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@

class Assets extends AssetBundle
{

public $publishOptions = [
'forceCopy' => true
'forceCopy' => true,
];
public $css = [
'mostactiveusers.css',
Expand Down
11 changes: 4 additions & 7 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@

class Module extends \humhub\components\Module
{

/**
* On build of the dashboard sidebar widget, add the mostactiveusers widget if module is enabled.
*
* @param type $event
* @param type $event
*/
public static function onSidebarInit($event)
{
if (Yii::$app->hasModule('mostactiveusers')) {

$event->sender->addWidget(widgets\Sidebar::className(), array(), array(
'sortOrder' => 400
));
$event->sender->addWidget(widgets\Sidebar::className(), [], [
'sortOrder' => 400,
]);
}
}

Expand All @@ -42,5 +41,3 @@ public function enable()
}

}

?>
1 change: 0 additions & 1 deletion config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@
['class' => Sidebar::className(), 'event' => Sidebar::EVENT_INIT, 'callback' => ['humhub\modules\mostactiveusers\Module', 'onSidebarInit']],
],
];
?>
9 changes: 3 additions & 6 deletions controllers/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
class ConfigController extends \humhub\modules\admin\components\Controller
{

/**
* Configuration Action for Super Admins
*/
Expand All @@ -27,11 +26,9 @@ public function actionConfig()
return $this->redirect(['/mostactiveusers/config/config']);
}

return $this->render('config', array(
'model' => $form
));
return $this->render('config', [
'model' => $form,
]);
}

}

?>
11 changes: 4 additions & 7 deletions controllers/ListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/
class ListController extends \humhub\components\Controller
{

public $pageSize = 10;

/**
Expand All @@ -21,8 +20,8 @@ public function behaviors()
return [
'acl' => [
'class' => \humhub\components\behaviors\AccessControl::className(),
'guestAllowedActions' => ['list']
]
'guestAllowedActions' => ['list'],
],
];
}

Expand All @@ -38,11 +37,9 @@ public function actionList()
$query->offset($pagination->offset)->limit($pagination->limit);

return $this->renderAjax('list', [
'users' => $query->all(),
'pagination' => $pagination
'users' => $query->all(),
'pagination' => $pagination,
]);
}

}

?>
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

0.2.8 - Unreleased
----------------------
- Enh #24: Use PHP CS Fixer
-
0.2.7 - April 14, 2022
----------------------
- Enh #4823: Remove CHTML/CActiveForm usages
Expand Down
1 change: 0 additions & 1 deletion models/ActiveUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
class ActiveUser extends \humhub\modules\user\models\User
{

public $count_posts;
public $count_likes;
public $count_comments;
Expand Down
13 changes: 6 additions & 7 deletions models/ConfigureForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@

class ConfigureForm extends \yii\base\Model
{

public $noUsers;

public function rules()
{
return array(
array('noUsers', 'required'),
array('noUsers', 'integer', 'min' => 0, 'max' => 50),
);
return [
['noUsers', 'required'],
['noUsers', 'integer', 'min' => 0, 'max' => 50],
];
}

public function attributeLabels()
{
return array(
return [
'noUsers' => Yii::t('MostactiveusersModule.base', 'The number of most active users that will be shown.'),
);
];
}

}
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Most Active Users",
"description": "Adds a widget to the dashboard showing the most active users",
"keywords": ["most", "active", "users", "widget", "dashboard"],
"version": "0.2.7",
"version": "0.2.8",
"humhub": {
"minVersion": "1.0"
},
Expand Down
9 changes: 3 additions & 6 deletions widgets/Sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@

class Sidebar extends \humhub\components\Widget
{

public function run()
{
$users = ActiveUser::find()->limit((int) Setting::Get('noUsers', 'mostactiveusers'))->all();
if (count($users) == 0) {
return;
}

return $this->render('sidebar', array(
'users' => $users
));
return $this->render('sidebar', [
'users' => $users,
]);
}

}

?>

0 comments on commit 645500d

Please sign in to comment.