Completed
Push — master ( 2391a8...1d9387 )
by Garrett
02:10
created

HTMLStrObj::nl2br()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace StringObject\Decorator;
4
5
use StringObject\StrObj;
6
7
class HTMLStrObj extends TextStrObj
8
{
9
    public function nl2br()
10
    {
11
        return new self(\nl2br($this->raw, false));
0 ignored issues
show
Bug introduced by
The property raw does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
Unused Code introduced by
The call to HTMLStrObj::__construct() has too many arguments starting with \nl2br($this->raw, false).

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
12
    }
13
14
    public function nl2brX()
15
    {
16
        return new self(\nl2br($this->raw, true));
0 ignored issues
show
Unused Code introduced by
The call to HTMLStrObj::__construct() has too many arguments starting with \nl2br($this->raw, true).

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
17
    }
18
}
19