Test Failed
Push — master ( fdb79d...2e4512 )
by Chris
19:35
created

unregisteredOptionException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Leonidas\Library\System;
4
5
use Leonidas\Contracts\System\BaseSystemModelTypeInterface;
6
use UnexpectedValueException;
7
8
abstract class AbstractSystemModelTypeRegistrar
9
{
10
    protected function unregisteredOptionException(string $option): UnexpectedValueException
11
    {
12
        return new UnexpectedValueException(
13
            "There is no registered handler for option \"{$option}\" provided."
14
        );
15
    }
16
17
    protected function getBaseArgs(BaseSystemModelTypeInterface $type): array
18
    {
19
        return [
20
            'labels' => $type->getLabels(),
21
            'description' => $type->getDescription(),
22
            'public' => $type->isPublic(),
23
            'hierarchical' => $type->isHierarchical(),
24
            'publicly_queryable' => $type->isPubliclyQueryable(),
25
            'show_ui' => $type->isShownInUi(),
26
            'show_in_menu' => $type->getShownInMenu(),
27
            'show_in_nav_menus' => $type->isShownInNavMenus(),
28
            'capabilities' => $type->getCapabilities(),
29
            'rewrite' => $type->getRewrite(),
30
            'query_var' => $type->getQueryVar(),
31
            'show_in_rest' => $type->isShownInRest(),
32
            'rest_base' => $type->getRestBase(),
33
            'rest_namespace' => $type->getRestNamespace(),
34
            'rest_controller_class' => $type->getRestControllerClass(),
35
        ];
36
    }
37
}
38