Jeremy Mikola
jmikola
__construct(array $elements)count()getIterator()slice($offset, $length)matching(Criteria $criteria)exists(Closure $p)filter(Closure $p)forAll(Closure $p)map(Closure $p)partition(Closure $p)Collection interface extends
Countable, IteratorAggregate, ArrayAccess
| CC | Complexity |
|---|---|
| 1–4 | Low |
| 5–7 | Moderate |
| 8–10 | High |
| 11+ | Very high |
public function foo($a, $b, $c, $d)
{
if ($a) {
echo 'a';
}
if ($b) {
echo 'b';
}
if ($c) {
echo 'c';
}
if ($d) {
echo 'd';
}
}
CC = 5 and NPath = 16!
Worst case: NPath = 2(CC - 1)
| Good Business Value | Poor Business Value | |
|---|---|---|
| Clean Code | Excellent | Bad |
| Dirty Code | Good | Garbage |