ChainLocaleResolver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 1
Metric Value
wmc 3
eloc 8
c 4
b 0
f 1
dl 0
loc 14
rs 10
ccs 7
cts 7
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 8 3
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Translation\Resolvers;
5
6
use Nexendrie\Utils\Collection;
7
use Nexendrie\Translation\ILocaleResolver;
8
9
/**
10
 * ChainResolver
11
 *
12
 * @author Jakub Konečný
13
 */
14 1
final class ChainLocaleResolver extends Collection implements ILocaleResolver {
15 1
  use \Nette\SmartObject;
16
17
  /** @var string */
18
  protected $class = ILocaleResolver::class;
19
  
20
  public function resolve(): ?string {
21 1
    foreach($this as $resolver) {
22 1
      $lang = $resolver->resolve();
23 1
      if($lang !== null) {
24 1
        return $lang;
25
      }
26
    }
27 1
    return null;
28
  }
29
}
30
?>