Completed
Push — master ( 446f2e...32b2c3 )
by Nelson
11:26
created

compareMethodArgumentsProvider()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 32
Code Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 27
nc 1
nop 0
dl 0
loc 32
rs 8.8571
c 0
b 0
f 0
1
<?php
2
/**
3
 * PHP: Nelson Martell Library file
4
 *
5
 * Content:
6
 * - Trait definition.
7
 *
8
 * Copyright © 2016 Nelson Martell (http://nelson6e65.github.io)
9
 *
10
 * Licensed under The MIT License (MIT)
11
 * For full copyright and license information, please see the LICENSE
12
 * Redistributions of files must retain the above copyright notice.
13
 *
14
 * @copyright 2016 Nelson Martell
15
 * @link      http://nelson6e65.github.io/php_nml/
16
 * @since     v0.6.0
17
 * @license   http://www.opensource.org/licenses/mit-license.php The MIT License (MIT)
18
 * */
19
20
namespace NelsonMartell\Test\DataProviders;
21
22
use NelsonMartell\Object;
23
use NelsonMartell\Test\Helpers\ExporterPlugin;
24
use NelsonMartell\Test\Helpers\ConstructorMethodTester;
25
use NelsonMartell\Test\Helpers\IComparerTester;
26
27
/**
28
 *
29
 * @author Nelson Martell <[email protected]>
30
 * @internal
31
 * */
32
trait ObjectTestProvider
33
{
34
    use ExporterPlugin;
35
    use ConstructorMethodTester;
36
    use IComparerTester;
37
38
    # ConstructorMethodTester
0 ignored issues
show
Coding Style introduced by
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Loading history...
39
40
    public function getTargetClassName()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
41
    {
42
        return Object::class;
43
    }
44
45
    public function goodConstructorArgumentsProvider()
46
    {
47
        return [[]];
48
    }
49
50
51
    public function badConstructorArgumentsProvider()
52
    {
53
        return null;
54
    }
55
    #
0 ignored issues
show
Coding Style introduced by
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Loading history...
56
57
58
    # IComparerTester
0 ignored issues
show
Coding Style introduced by
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Loading history...
59
    public function compareMethodArgumentsProvider()
60
    {
61
        $obj = new \stdClass();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
62
        $obj->one = 1;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
63
        $obj->nine = 9;
64
65
        $args = [
66
            'integers: same value, +-'      => [1, 5, -5],
67
            'integers: same value, -+'      => [-1, -5, 5],
68
            'integers: same value, --'      => [0, -5, -5],
69
            'integers: same value, ++'      => [0, 5, 5],
70
            'integers: different value, +-' => [1, 90, -8],
71
            'integers: different value, -+' => [-1, -8, 90],
72
            'integers: different value, --' => [1, -8, -90],
73
            'integers: different value, ++' => [-1, 8, 90],
74
            'strings: same'                 => [0, 'world', 'world'],
75
            'strings: leading space, <'     => [-1, 'world', 'world '],
76
            'strings: leading space, >'     => [1, 'world ', 'world'],
77
            'strings: different chars, >'   => [1, 'hola', 'hello'],
78
            'strings: different chars, <'   => [-1, 'hello', 'hola'],
79
            'arrays: same'                  => [0, ['one' => 'world'], ['one' => 'world']],
80
            'arrays: different count, >'    => [1, ['hola', 'mundo'], ['hello']],
81
            'arrays: different count, <'    => [-1, ['hello'], ['hola', 'mundo']],
82
            'array > array (values)'        => [1, ['hola', 'mundo'], ['hello', 'world']],
83
            'array < array (values)'        => [-1, ['hello', 'world'], ['hola', 'mundo']],
84
            'array < array (keys)'          => [-1, ['hola', 'mundo'], ['one' => 'hello', 'two' => 'world']],
85
            'stdClass = stdClass'           => [0, $obj, $obj],
86
            'stdClass (empty) < stdClass'   => [-1, new \stdClass, $obj],
87
        ];
88
89
        return $args;
90
    }
91
92
    public function compareMethodArraysProvider()
93
    {
94
        return [
95
            'integer[]'           => [[-67, -9, 0, 4, 5, 6]],
96
            'string[]'            => [['a', 'b', 'c', 'd', 'z', 'z1']],
97
        ];
98
    }
99
    #
0 ignored issues
show
Coding Style introduced by
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Loading history...
100
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
101