smartinmedia/cunity

View on GitHub
lib/modules/Core/View/View.php

Summary

Maintainability
C
1 day
Test Coverage

File View.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * ########################################################################################
 * ## CUNITY(R) V2.0 - An open source social network / "your private social network"     ##
Severity: Minor
Found in lib/modules/Core/View/View.php - About 2 hrs to fix

Method show has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function show()
    {
        if (Login::loggedIn() && Get::get('m') !== 'admin') {
            $this->registerScript('search', 'livesearch');
            $this->registerScript('messages', 'message-modal');
Severity: Major
Found in lib/modules/Core/View/View.php - About 2 hrs to fix

Method initTranslator has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function initTranslator()
    {
        Cunity::init();
        $locale = new Zend_Locale(Cunity::get('settings')->getSetting('core.language'));

Severity: Minor
Found in lib/modules/Core/View/View.php - About 1 hr to fix

Function registerCunityPlugin has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function registerCunityPlugin($pluginName, array $files)
    {
        if (file_exists('plugins/'.$pluginName)) {
            if (!empty($files)) {
                foreach ($files as $file) {
Severity: Minor
Found in lib/modules/Core/View/View.php - About 1 hr to fix

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 registerScript has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function registerScript($module, $scriptName)
    {
        if ((!empty($module))) {
            $module = ucfirst($module).'/styles/javascript/';
        } else {
Severity: Minor
Found in lib/modules/Core/View/View.php - About 1 hr to fix

Function show has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function show()
    {
        if (Login::loggedIn() && Get::get('m') !== 'admin') {
            $this->registerScript('search', 'livesearch');
            $this->registerScript('messages', 'message-modal');
Severity: Minor
Found in lib/modules/Core/View/View.php - About 35 mins to fix

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

There are no issues that match your filters.

Category
Status