budde377/Part

View on GitHub

Showing 140 of 140 total issues

FileImpl has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class FileImpl implements File
{
    use FilePathTrait;
    protected $filePath;
    protected $mode = File::FILE_MODE_RW_POINTER_AT_END;
Severity: Minor
Found in lib/util/file/FileImpl.php - About 2 hrs to fix

UserLibraryImpl has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class UserLibraryImpl implements UserLibrary, Observer, \Serializable
{
    private $container;
    private $userList = [];
    private $database;
Severity: Minor
Found in lib/model/user/UserLibraryImpl.php - About 2 hrs to fix

Function setUpElement has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function setUpElement()
    {
        parent::setUpElement();
        $path = "/";
        if(isset($_SERVER["HTTP_REFERER"]) && ($url = parse_url($_SERVER["HTTP_REFERER"])) &&
Severity: Minor
Found in lib/view/page_element/LogoutPageElementImpl.php - About 2 hrs 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 parseDecoded has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function parseDecoded($obj){

        if(!is_array($obj)){
            return $obj;
        }
Severity: Major
Found in lib/controller/json/ParserImpl.php - About 2 hrs to fix

Function userLogin has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function userLogin()
    {

        return function (UserLibrary $instance, $username, $password) {
            if (($user = $instance->getUser($username)) == null && $this->validMail($username)) {
Severity: Minor
Found in lib/controller/ajax/type_handler/UserLibraryTypeHandlerImpl.php - About 2 hrs 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    private function callPreCallFunctions($type, $instance, $functionName, &$arguments)
    {

        $this->callArraysOfCallFunctions(function($function) use($type, $instance, $functionName, &$arguments) {
            $function($type, $instance, $functionName, $arguments);
lib/controller/ajax/type_handler/GenericObjectTypeHandlerImpl.php on lines 500..510

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 128.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    private function callPostCallFunctions($type, $instance, $functionName, &$result)
    {
        $this->callArraysOfCallFunctions(function($function) use($type, $instance, $functionName, &$result) {
            $function($type, $instance, $functionName, $result);
        },
lib/controller/ajax/type_handler/GenericObjectTypeHandlerImpl.php on lines 488..498

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 128.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function internalHandleProgram has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private function internalHandleProgram(Program $input)
    {
        $result = null;
        if ($input instanceof CompositeFunction) {

Severity: Minor
Found in lib/controller/ajax/ServerImpl.php - About 2 hrs 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
namespace ChristianBudde\Part\view\template;
/**
 * Created by PhpStorm.
 * User: budde
Severity: Major
Found in lib/view/template/PageVariableTwigTokenParserImpl.php and 1 other location - About 2 hrs to fix
lib/view/template/PageContentTwigTokenParserImpl.php on lines 1..46

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 124.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
namespace ChristianBudde\Part\view\template;
/**
 * Created by PhpStorm.
 * User: budde
Severity: Major
Found in lib/view/template/PageContentTwigTokenParserImpl.php and 1 other location - About 2 hrs to fix
lib/view/template/PageVariableTwigTokenParserImpl.php on lines 1..48

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 124.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method __construct has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct(BackendSingletonContainer $container, Page $page, $id = "")
    {
        $connection = $container->getDBInstance()->getConnection();
        $this->container = $container;
        $this->page = $page;
Severity: Minor
Found in lib/model/page/PageContentImpl.php - About 1 hr to fix

Function handle has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function handle(array $types, JSONFunction $function, $instance = null, $generatedHandler = null)
    {
        foreach ($types as $type) {

            if ($generatedHandler instanceof TypeHandler) {
Severity: Minor
Found in lib/controller/ajax/ServerImpl.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

Function __get has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function __get($name)
    {
        $name = strtolower($name);
        switch ($name) {
            case 'site':
Severity: Minor
Found in lib/BackendSingletonContainerImpl.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

Function expectProgram has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function expectProgram()
    {
        $t = $this->expectType();
        $fc = $cf = null;
        if ($this->look_ahead == Lexer::T_L_BRACKET || ($this->look_ahead == Lexer::T_DOT && $this->look_ahead_2 != Lexer::T_DOT && $this->look_ahead_2 != Lexer::T_L_BRACKET)) {
Severity: Minor
Found in lib/controller/function_string/ParserImpl.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 __get has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __get($name)
    {
        $name = strtolower($name);
        switch ($name) {
            case 'site':
Severity: Minor
Found in lib/BackendSingletonContainerImpl.php - About 1 hr to fix

Method setUpElement has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setUpElement()
    {
        parent::setUpElement();
        $path = "/";
        if(isset($_SERVER["HTTP_REFERER"]) && ($url = parse_url($_SERVER["HTTP_REFERER"])) &&
Severity: Minor
Found in lib/view/page_element/LogoutPageElementImpl.php - About 1 hr to fix

Function getPageElement has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPageElement($name, $cached = true)
    {
        if($cached && isset($this->cache[$name])){
            return $this->cache[$name];
        }
Severity: Minor
Found in lib/view/page_element/PageElementFactoryImpl.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

Function detectLoop has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function detectLoop($childID, $parentID)
    {

        $prevID = $parentID;
        $loopDetected = false;
Severity: Minor
Found in lib/model/page/PageOrderImpl.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

Function listLog has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function listLog($level = null, $time = 0)
    {
        if(!$this->exists()){
            return array();
        }
Severity: Minor
Found in lib/util/file/LogFileImpl.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

Function listFolder has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function listFolder($listType = Folder::LIST_FOLDER_ALL)
    {
        $dir = @scandir($this->folderPath);
        if ($dir === false) {
            return false;
Severity: Minor
Found in lib/util/file/FolderImpl.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

Severity
Category
Status
Source
Language