Showing 63 of 816 total issues
File Organization.php
has 625 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* _ __ __ _____ _____ ___ ____ _____
* | | / // // ___//_ _// || __||_ _|
Organization
has 60 functions (exceeds 20 allowed). Consider refactoring. Open
class Organization extends User
{
use SelfBlameableTrait;
const TYPE_ORGANIZATION = 1;
Member
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Member extends BaseBlameableModel
{
public $createdByAttribute = 'organization_guid';
public $updatedByAttribute = false;
public $hostClass = Organization::class;
Function addMember
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function addMember(&$member)
{
if ($this->getIsNewRecord()) {
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
File Member.php
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* _ __ __ _____ _____ ___ ____ _____
* | | / // // ___//_ _// || __||_ _|
Method search
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search($params)
{
$query = $this->query;
$dataProvider = new ActiveDataProvider([
'query' => $query,
File UserOrganizationTrait.php
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* _ __ __ _____ _____ ___ ____ _____
* | | / // // ___//_ _// || __||_ _|
Method search
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search($params)
{
$query = $this->query;
$dataProvider = new ActiveDataProvider([
'query' => $query,
Function actionAssignSetUpOrganization
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function actionAssignSetUpOrganization($user, $limit = 1)
{
$user = $this->getUser($user);
$permission = new SetUpOrganization();
$limit = is_numeric($limit) ? (int) $limit : 1;
- 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 addMember
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addMember(&$member)
{
if ($this->getIsNewRecord()) {
return false;
}
Function submit
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function submit()
{
try {
if ($this->organization->isOrganization()) {
if ($this->exclude_other_members != ($this->organization->isExcludeOtherMembers ? '1' : '0')) {
- 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 actionAssignSetUpOrganization
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionAssignSetUpOrganization($user, $limit = 1)
{
$user = $this->getUser($user);
$permission = new SetUpOrganization();
$limit = is_numeric($limit) ? (int) $limit : 1;
Method actions
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actions()
{
return [
'index' => [
'class' => 'rhosocial\organization\web\organization\controllers\my\IndexAction',
Method behaviors
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::class,
Method prepareQuery
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepareQuery($query = null)
{
if (!$query) {
$query = $this->getQuery();
}
Method attributeHints
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function attributeHints()
{
$topName = $this->organization->isDepartment() ? $this->organization->topOrganization->profile->name . ' (' . $this->organization->topOrganization->getID() . ')' : '';
$parentName = $this->organization->isDepartment() ? $this->organization->parent->profile->name . ' (' . $this->organization->parent->getID() . ')' : '';
return [
Method revokeOrganization
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function revokeOrganization($organization, $revokeIfHasChildren = true)
{
if (!($organization instanceof $this->organizationClass))
{
$class = $this->organizationClass;
Method behaviors
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::class,
Method submit
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function submit()
{
try {
if ($this->organization->isOrganization()) {
if ($this->exclude_other_members != ($this->organization->isExcludeOtherMembers ? '1' : '0')) {
Method actionJoin
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionJoin($entrance)
{
$organization = static::getOrganization($entrance);
$user = Yii::$app->user->identity;
if ($organization->creator->equals($user)) {