PostTypes   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 34
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getPostTypeResource() 0 3 1
A optionHandlerService() 0 3 1
A postTypeResourceKey() 0 3 1
A factory() 0 3 1
A postTypes() 0 3 1
A optionHandlers() 0 7 2
1
<?php
2
3
namespace Leonidas\Framework\Module;
4
5
use Leonidas\Contracts\System\Model\PostType\PostTypeFactoryInterface;
6
use Leonidas\Contracts\System\Model\PostType\PostTypeOptionHandlerCollectionInterface;
7
use Leonidas\Framework\Module\Abstracts\PostTypeRegistrationModule;
8
use Leonidas\Library\System\Model\PostType\PostTypeFactory;
9
10
class PostTypes extends PostTypeRegistrationModule
11
{
12
    protected function postTypes(): array
13
    {
14
        return $this->factory()->createMany($this->getPostTypeResource());
15
    }
16
17
    protected function getPostTypeResource(): array
18
    {
19
        return $this->getConfig($this->postTypeResourceKey());
20
    }
21
22
    protected function factory(): PostTypeFactoryInterface
23
    {
24
        return new PostTypeFactory($this->extension->prefix('', '_'));
25
    }
26
27
    protected function optionHandlers(): ?PostTypeOptionHandlerCollectionInterface
28
    {
29
        $service = $this->optionHandlerService();
30
31
        return $this->hasService($service)
32
            ? $this->getService($service)
33
            : null;
34
    }
35
36
    protected function postTypeResourceKey(): string
37
    {
38
        return 'post_types';
39
    }
40
41
    protected function optionHandlerService(): string
42
    {
43
        return 'post_type_option_handlers';
44
    }
45
}
46