getSetEmptyLineDataProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 60
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 60
c 0
b 0
f 0
rs 9.5555
cc 1
eloc 20
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
  namespace Funivan\Cs\Tools\Php\LineAfterOpenTag\Tests;
4
5
  use Funivan\Cs\Tools\Php\LineAfterOpenTag\LineAfterOpenTagFixer;
6
  use Tests\Funivan\Cs\BaseTestCase;
7
8
  /**
9
   *
10
   */
11
  class LineAfterOpenTagFixerTest extends BaseTestCase {
12
13
14
    /**
15
     * @return array
16
     */
17
    public function getSetEmptyLineDataProvider() {
18
      return [
19
        [
20
          '<?php
21
22
23
echo 1;',
24
          '<?php
25
26
echo 1;',
27
28
        ],
29
        [
30
          '<?php echo 1;',
31
          '<?php 
32
33
echo 1;',
34
        ],
35
        [
36
          '<?php
37
        echo 1;',
38
          '<?php
39
40
        echo 1;',
41
        ],
42
        [
43
          '<? echo 1;',
44
          '<?
45
46
 echo 1;',
47
          'process' => (boolean) ini_get('short_open_tag'),
48
        ],
49
        [
50
          '<?
51
echo 1;',
52
          '<?
53
54
echo 1;',
55
          'process' => (boolean) ini_get('short_open_tag'),
56
        ],
57
        [
58
          '<?
59
echo 1;',
60
          '<?
61
62
echo 1;',
63
          'process' => (boolean) ini_get('short_open_tag'),
64
        ],
65
        [
66
          '<?
67
68
69
echo 1;',
70
          '<?
71
72
echo 1;',
73
          'process' => (boolean) ini_get('short_open_tag'),
74
        ],
75
      ];
76
    }
77
78
79
    /**
80
     * @dataProvider getSetEmptyLineDataProvider
81
     * @param string $input
82
     * @param string $expect
83
     * @param bool $process
84
     */
85
    public function testSetEmptyLine($input, $expect, $process = true) {
86
      if ($process === false) {
87
        static::markTestSkipped('PHP short open tags are not enabled.');
88
        return;
89
      }
90
91
      self::assertFixer(new LineAfterOpenTagFixer(), $input, $expect);
92
    }
93
94
  }
95