Types   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 5
eloc 10
c 2
b 0
f 2
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A all() 0 6 2
A findByName() 0 9 3
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: aappen
5
 * Date: 01.10.18
6
 * Time: 18:20
7
 */
8
9
namespace seretos\testrail\api;
10
11
12
class Types extends AbstractApi
13
{
14
    private $cache = null;
15
    public function all()
16
    {
17
        if ($this->cache === null) {
18
            $this->cache = $this->connector->send_get('get_case_types');
19
        }
20
        return $this->cache;
21
    }
22
23
    public function findByName(string $name)
24
    {
25
        $types = $this->all();
26
        foreach ($types as $type) {
27
            if ($type['name'] === $name) {
28
                return $type;
29
            }
30
        }
31
        return [];
32
    }
33
}