Showing 31 of 33 total issues

Method redirect has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function redirect()
    {
        $redirect = false;
        $file = $this->file('301.txt');
        if (is_file($file)) {
Severity: Minor
Found in src/Component.php - About 1 hr to fix

    Function display has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function display($content)
        {
            $html = array();
            if (preg_match('/<\s*!doctype\s.*>/i', $content, $match)) {
                $content = mb_substr(mb_strstr($content, $match[0]), mb_strlen($match[0]));
    Severity: Minor
    Found in src/Component.php - About 45 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

    Function send has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function send($response = '', $status = 200, array $headers = array())
        {
            if (!$response instanceof Response) {
                if (func_num_args() == 1 && is_numeric($response)) {
                    $status = (int) $response;
    Severity: Minor
    Found in src/Component.php - About 45 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

    Function tag has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function tag($name, array $attributes, $content = null)
        {
            $args = func_get_args();
            $tag = array_shift($args);
            $attributes = array_shift($args);
    Severity: Minor
    Found in src/Component.php - About 45 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

    Function get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function get($key, $default = null)
        {
            if ($this->resumable() && $this->started()) {
                $session = $_SESSION;
                foreach ($this->explode($key) as $name) {
    Severity: Minor
    Found in src/Session.php - About 45 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

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

        public function enforce($url, $redirect = 301)
        {
            list($url, $path, $suffix, $query) = $this->formatLocalPath($url, 'array');
            $compare = $this->url['path'];
            if (!empty($path)) {
    Severity: Minor
    Found in src/Component.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

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

        public function &__get($name)
        {
            // This method must return a reference and not use ternary operators for __set()ing multi-dimensional arrays
            // http://stackoverflow.com/questions/4310473/using-set-with-arrays-solved-but-why
            // http://stackoverflow.com/questions/5966918/return-null-by-reference-via-get
    Severity: Minor
    Found in src/Component.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

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

        protected function scripts()
        {
            // Used in $this->display()
            if (isset($this->data['jquery'])) {
                $jquery = array_filter(array_unique($this->data['jquery']));
    Severity: Minor
    Found in src/Component.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

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

        public function dir($folder = null)
        {
            $folders = func_get_args();
            if ($folder == 'set') {
                list($folder, $name, $dir) = $folders;
    Severity: Minor
    Found in src/Component.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

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

        public function style($css)
        {
            if (is_array($css)) {
                foreach ($css as $tag => $rules) {
                    if (is_array($rules)) {
    Severity: Minor
    Found in src/Component.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

    Avoid too many return statements within this method.
    Open

            return htmlspecialchars($this->formatLocalPath($base.$query.$fragment));
    Severity: Major
    Found in src/Component.php - About 30 mins to fix
      Severity
      Category
      Status
      Source
      Language