getArticle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
c 1
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
/**
4
 * Return the correct article
5
 * for preceding a specific word.
6
 *
7
 * @param string $word
8
 *
9
 * @return string
10
 */
11
function getArticle(string $word) :string
12
{
13 27
    return !in_array(strtolower($word[0]), ['a', 'e', 'i', 'o', 'u']) ? 'a' : 'an';
14
}
15