Test Failed
Pull Request — master (#38)
by Sergei
08:01 queued 05:42
created

Classifier::find()   C

Complexity

Conditions 14
Paths 29

Size

Total Lines 62
Code Lines 34

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 36
CRAP Score 14.0038

Importance

Changes 4
Bugs 0 Features 0
Metric Value
cc 14
eloc 34
c 4
b 0
f 0
nc 29
nop 0
dl 0
loc 62
ccs 36
cts 37
cp 0.973
crap 14.0038
rs 6.2666

How to fix   Long Method    Complexity   

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
declare(strict_types=1);
4
5
namespace Yiisoft\Classifier;
6
7
final class Classifier extends AbstractClassifier
8
{
9
    /**
10
     * @psalm-suppress UnresolvableInclude
11
     */
12
    protected function getAvailableClasses(): iterable
13
    {
14
        $files = $this->getFiles();
15
16
        foreach ($files as $file) {
17
            require_once $file;
18
        }
19
20
        foreach (get_declared_classes() as $className) {
21
            if ($this->skipClass($className)) {
22
                continue;
23
            }
24
25
            yield $className;
26
        }
27
    }
28
}
29