Passed
Push — master ( 7a981c...2773c2 )
by stéphane
04:34
created

Compact   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A wrap() 0 4 1
A jsonSerialize() 0 5 3
A __construct() 0 3 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace Dallgoot\Yaml;
4
5
6
/**
0 ignored issues
show
Coding Style introduced by
Doc comment is empty
Loading history...
7
 *
8
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
9
class Compact extends \ArrayIterator implements \JsonSerializable
10
{
11
	// private static $value;
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 4 spaces, found 1
Loading history...
12
 //    public function __construct($argument)
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 4 spaces, found 1
Loading history...
13
 //    {
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 4 spaces, found 1
Loading history...
14
 //    	self::$value = $argument;
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 4 spaces, found 1
Loading history...
15
 //        // if ($argument instanceof \Countable && count($argument) > 0) {
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 4 spaces, found 1
Loading history...
16
 //        //     # it's an array-like
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 4 spaces, found 1
Loading history...
17
 //        // } else {
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 4 spaces, found 1
Loading history...
18
 //        //     //it's an object-like
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 4 spaces, found 1
Loading history...
19
 //        // }
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 4 spaces, found 1
Loading history...
20
 //    }
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 4 spaces, found 1
Loading history...
21
	//
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 4 spaces, found 1
Loading history...
22
	public function __construct()
1 ignored issue
show
Coding Style introduced by
Line indented incorrectly; expected 4 spaces, found 1
Loading history...
Coding Style introduced by
You must use "/**" style comments for a function comment
Loading history...
23
    {
0 ignored issues
show
Coding Style introduced by
Opening brace indented incorrectly; expected 1 spaces, found 4
Loading history...
24
        parent::__construct([], 1);//1 = Array indices can be accessed as properties in read/write.
25
    }
0 ignored issues
show
Coding Style introduced by
Closing brace indented incorrectly; expected 1 spaces, found 4
Loading history...
26
27
    public function jsonSerialize()
0 ignored issues
show
Coding Style introduced by
Missing function doc comment
Loading history...
28
    {
29
        $prop = get_object_vars($this);
30
        if (count($prop) > 0) return $prop;
1 ignored issue
show
Coding Style introduced by
Inline control structures are discouraged
Loading history...
31
        if (count($this) > 0) return iterator_to_array($this);
1 ignored issue
show
Coding Style introduced by
Inline control structures are discouraged
Loading history...
32
    }
33
34
    public static function wrap($arrayOrObject)
0 ignored issues
show
Unused Code introduced by
The parameter $arrayOrObject is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

34
    public static function wrap(/** @scrutinizer ignore-unused */ $arrayOrObject)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Coding Style introduced by
Missing function doc comment
Loading history...
35
    {
36
    	//
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 8 spaces, found 5
Loading history...
37
    	return $this;
0 ignored issues
show
Comprehensibility Best Practice introduced by
Using $this inside a static method is generally not recommended and can lead to errors in newer PHP versions.
Loading history...
Coding Style introduced by
Line indented incorrectly; expected at least 8 spaces, found 5
Loading history...
38
    }
39
}
40