Completed
Pull Request — master (#2)
by Woody
03:03 queued 47s
created

ArrayBench::words()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 106
Code Lines 102

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 106
rs 8.2857
cc 1
eloc 102
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 Equip;
4
5
class ArrayBench
6
{
7
    public function benchHead()
8
    {
9
        return \Equip\head($this->words());
10
    }
11
12
    public function benchTail()
13
    {
14
        return \Equip\tail($this->words());
15
    }
16
17
    private function words()
18
    {
19
        // 100 random words
20
        return [
21
            'B-G',
22
            'Elavil',
23
            'Gal',
24
            'Heilbronn',
25
            'Jawing',
26
            'Northumbria',
27
            'Polycarp',
28
            'Suyog',
29
            'Thessalians',
30
            'Yemenis',
31
            'adheres',
32
            'anacardic',
33
            'anastasis',
34
            'arised',
35
            'averseness',
36
            'awright',
37
            'bandgaps',
38
            'bareboat',
39
            'beader',
40
            'bearishness',
41
            'boxlike',
42
            'buddha',
43
            'chain-bearer',
44
            'chartists',
45
            'clickjack',
46
            'cogence',
47
            'colorways',
48
            'conundrums',
49
            'correlate',
50
            'cultist',
51
            'directum',
52
            'disparity',
53
            'dribble',
54
            'earth-closet',
55
            'embank',
56
            'ethnographically',
57
            'evokers',
58
            'exclaimed',
59
            'favela',
60
            'foodist',
61
            'grenadilla',
62
            'gunning',
63
            'hearthrug',
64
            'humpy',
65
            'indels',
66
            'indeterminant',
67
            'inelastic',
68
            'innateness',
69
            'intering',
70
            'interlay',
71
            'ire',
72
            'izar',
73
            'jaden',
74
            'jest',
75
            'joshing',
76
            'leader',
77
            'leave-taking',
78
            'levitical',
79
            'liveryman',
80
            'loggias',
81
            'lubricous',
82
            'luxuria',
83
            'main-hatch',
84
            'mealie',
85
            'minigolf',
86
            'misgives',
87
            'moneyspinning',
88
            'nanomachine',
89
            'narrativized',
90
            'nepetalactone',
91
            'omosternum',
92
            'onry',
93
            'oppidans',
94
            'outproduced',
95
            'palpal',
96
            'parallelled',
97
            'paresseuse',
98
            'phlebotomy',
99
            'poignant',
100
            'poinsettias',
101
            'psychedelia',
102
            'redoute',
103
            'saxhorn',
104
            'schottische',
105
            'semifluid',
106
            'sheepishness',
107
            'someways',
108
            'striped',
109
            'thessalonica',
110
            'ticca',
111
            'timekiller',
112
            'typosquatters',
113
            'unclenching',
114
            'undersupplying',
115
            'unforeseeable',
116
            'unreckonable',
117
            'untaxed',
118
            'ushers',
119
            'vivers',
120
            'whf'
121
        ];
122
    }
123
}
124