Code Duplication    Length = 36-36 lines in 6 locations

src/Api/AbilityScores.php 1 location

@@ 14-49 (lines=36) @@
11
 * Class AbilityScores
12
 * @package Darkgoldblade01\Dnd5eApi\Api
13
 */
14
class AbilityScores extends Dnd5eApi
15
{
16
17
    /**
18
     * @var string
19
     */
20
    protected $base_uri = 'https://www.dnd5eapi.co/api/ability-scores/';
21
22
    /**
23
     * @return array
24
     * @throws GuzzleException|NotFoundException
25
     */
26
    public function all(): array
27
    {
28
        $response = [];
29
        $items = $this->get('');
30
        foreach($items['results'] AS $item) {
31
            $response[] = (new AbilityScoresModel())->fill($this->get($item['index']));
32
        }
33
        return $response;
34
    }
35
36
    /**
37
     * @param $name
38
     * @param $arguments
39
     * @return AbilityScoresModel
40
     * @throws GuzzleException|NotFoundException
41
     */
42
    public function __call($name, $arguments): AbilityScoresModel
43
    {
44
        $response = $this->get($name);
45
        return (new AbilityScoresModel())->fill($response);
46
    }
47
48
49
}
50

src/Api/Proficiencies.php 1 location

@@ 14-49 (lines=36) @@
11
 * Class Skills
12
 * @package Darkgoldblade01\Dnd5eApi\Api
13
 */
14
class Proficiencies extends Dnd5eApi
15
{
16
17
    /**
18
     * @var string
19
     */
20
    protected $base_uri = 'https://www.dnd5eapi.co/api/proficiencies/';
21
22
    /**
23
     * @return array
24
     * @throws GuzzleException|NotFoundException
25
     */
26
    public function all(): array
27
    {
28
        $response = [];
29
        $items = $this->get('');
30
        foreach($items['results'] AS $item) {
31
            $response[] = (new ProficienciesModel())->fill($this->get($item['index']));
32
        }
33
        return $response;
34
    }
35
36
    /**
37
     * @param $name
38
     * @param $arguments
39
     * @return ProficienciesModel
40
     * @throws GuzzleException|NotFoundException
41
     */
42
    public function __call($name, $arguments): ProficienciesModel
43
    {
44
        $response = $this->get($name);
45
        return (new ProficienciesModel())->fill($response);
46
    }
47
48
49
}
50

src/Api/Skills.php 1 location

@@ 14-49 (lines=36) @@
11
 * Class Skills
12
 * @package Darkgoldblade01\Dnd5eApi\Api
13
 */
14
class Skills extends Dnd5eApi
15
{
16
17
    /**
18
     * @var string
19
     */
20
    protected $base_uri = 'https://www.dnd5eapi.co/api/skills/';
21
22
    /**
23
     * @return array
24
     * @throws GuzzleException|NotFoundException
25
     */
26
    public function all(): array
27
    {
28
        $response = [];
29
        $items = $this->get('');
30
        foreach($items['results'] AS $item) {
31
            $response[] = (new SkillsModel())->fill($this->get($item['index']));
32
        }
33
        return $response;
34
    }
35
36
    /**
37
     * @param $name
38
     * @param $arguments
39
     * @return SkillsModel
40
     * @throws GuzzleException|NotFoundException
41
     */
42
    public function __call($name, $arguments): SkillsModel
43
    {
44
        $response = $this->get($name);
45
        return (new SkillsModel())->fill($response);
46
    }
47
48
49
}
50

src/Api/Classes.php 1 location

@@ 14-49 (lines=36) @@
11
 * Class Classes
12
 * @package Darkgoldblade01\Dnd5eApi\Api
13
 */
14
class Classes extends Dnd5eApi
15
{
16
17
    /**
18
     * @var string
19
     */
20
    protected $base_uri = 'https://www.dnd5eapi.co/api/classes/';
21
22
    /**
23
     * @return array
24
     * @throws GuzzleException|NotFoundException
25
     */
26
    public function all(): array
27
    {
28
        $response = [];
29
        $items = $this->get('');
30
        foreach($items['results'] AS $item) {
31
            $response[] = (new ClassesModel())->fill($this->get($item['index']));
32
        }
33
        return $response;
34
    }
35
36
    /**
37
     * @param $name
38
     * @param $arguments
39
     * @return ClassesModel
40
     * @throws GuzzleException|NotFoundException
41
     */
42
    public function __call($name, $arguments): ClassesModel
43
    {
44
        $response = $this->get($name);
45
        return (new ClassesModel())->fill($response);
46
    }
47
48
49
}
50

src/Api/Languages.php 1 location

@@ 14-49 (lines=36) @@
11
 * Class Skills
12
 * @package Darkgoldblade01\Dnd5eApi\Api
13
 */
14
class Languages extends Dnd5eApi
15
{
16
17
    /**
18
     * @var string
19
     */
20
    protected $base_uri = 'https://www.dnd5eapi.co/api/languages/';
21
22
    /**
23
     * @return array
24
     * @throws GuzzleException|NotFoundException
25
     */
26
    public function all(): array
27
    {
28
        $response = [];
29
        $items = $this->get('');
30
        foreach($items['results'] AS $item) {
31
            $response[] = (new LanguagesModel())->fill($this->get($item['index']));
32
        }
33
        return $response;
34
    }
35
36
    /**
37
     * @param $name
38
     * @param $arguments
39
     * @return LanguagesModel
40
     * @throws GuzzleException|NotFoundException
41
     */
42
    public function __call($name, $arguments): LanguagesModel
43
    {
44
        $response = $this->get($name);
45
        return (new LanguagesModel())->fill($response);
46
    }
47
48
49
}
50

src/Api/SubClasses.php 1 location

@@ 14-49 (lines=36) @@
11
 * Class SubClasses
12
 * @package Darkgoldblade01\Dnd5eApi\Api
13
 */
14
class SubClasses extends Dnd5eApi
15
{
16
17
    /**
18
     * @var string
19
     */
20
    protected $base_uri = 'https://www.dnd5eapi.co/api/classes/';
21
22
    /**
23
     * @return array
24
     * @throws GuzzleException|NotFoundException
25
     */
26
    public function all(): array
27
    {
28
        $response = [];
29
        $items = $this->get('');
30
        foreach($items['results'] AS $item) {
31
            $response[] = (new SubClassesModel())->fill($this->get($item['index']));
32
        }
33
        return $response;
34
    }
35
36
    /**
37
     * @param $name
38
     * @param $arguments
39
     * @return SubClassesModel
40
     * @throws GuzzleException|NotFoundException
41
     */
42
    public function __call($name, $arguments): SubClassesModel
43
    {
44
        $response = $this->get($name);
45
        return (new SubClassesModel())->fill($response);
46
    }
47
48
49
}
50