Passed
Push — master ( 77b393...827c75 )
by Andreas
37:40
created

midcom_admin_rcs_handler_rcs::handler_callback()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @package midcom.admin.rcs
4
 * @author CONTENT CONTROL http://www.contentcontrol-berlin.de/
5
 * @copyright CONTENT CONTROL http://www.contentcontrol-berlin.de/
6
 */
7
8
use Symfony\Component\HttpFoundation\Response;
9
10
/**
11
 * @package midcom.admin.rcs
12
 */
13
class midcom_admin_rcs_handler_rcs extends midcom_services_rcs_handler
14
{
15
    protected $style_prefix = 'midcom-admin-rcs-';
16
17
    protected $url_prefix = '__ais/rcs/';
18
19 3
    protected function get_breadcrumbs() : array
20
    {
21 3
        $items = [];
22 3
        if (!is_a($this->object, midcom_db_topic::class)) {
23 3
            $items[] = [
24 3
                MIDCOM_NAV_URL => $this->get_object_url(),
25 3
                MIDCOM_NAV_NAME => $this->resolve_object_title()
26
            ];
27
        }
28 3
        return $items;
29
    }
30
31 3
    protected function reply(string $element) : Response
32
    {
33 3
        $this->_view_toolbar->add_item([
34 3
            MIDCOM_TOOLBAR_URL => $this->get_object_url(),
35 3
            MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n->get('back to %s'), $this->resolve_object_title()),
36 3
            MIDCOM_TOOLBAR_GLYPHICON => 'eject',
37
        ]);
38 3
        return $this->show($element);
39
    }
40
41 3
    protected function get_object_url() : string
42
    {
43 3
        return midcom::get()->permalinks->create_permalink($this->object->guid);
44
    }
45
46
    /**
47
     * Load the statics & prepend styledir
48
     */
49 3
    public function _on_initialize()
50
    {
51 3
        midcom::get()->style->prepend_component_styledir('midcom.admin.rcs');
52 3
    }
53
}
54