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

handler_callback()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author tarjei huse
4
 * @package midgard.admin.asgard
5
 * @copyright The Midgard Project, http://www.midgard-project.org
6
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
7
 */
8
9
use Symfony\Component\HttpFoundation\Response;
10
11
/**
12
 * Simple styling class to make html out of diffs and get a simple way
13
 * to provide rcs functionality
14
 *
15
 * @package midgard.admin.asgard
16
 */
17
class midgard_admin_asgard_handler_object_rcs extends midcom_services_rcs_handler
18
{
19
    use midgard_admin_asgard_handler;
20
21
    protected $style_prefix = 'midgard_admin_asgard_rcs_';
22
23
    protected $url_prefix = '__mfa/asgard/object/rcs/';
24
25
    protected function get_object_url() : string
26
    {
27
        return $this->router->generate('object_open', ['guid' => $this->object->guid]);
28
    }
29
30 3
    protected function get_breadcrumbs() : array
31
    {
32 3
        midgard_admin_asgard_plugin::bind_to_object($this->object, $this->_request_data['handler_id'], $this->_request_data);
33 3
        return midcom_core_context::get()->get_custom_key('midcom.helper.nav.breadcrumb') ?: [];
34
    }
35
36 3
    protected function reply(string $element) : Response
37
    {
38 3
        return $this->get_response($element);
39
    }
40
41
    /**
42
     * Load statics and l10n
43
     */
44 3
    public function _on_initialize()
45
    {
46 3
        midcom::get()->auth->require_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin');
47
48 3
        $this->_l10n = $this->_i18n->get_l10n('midcom.admin.rcs');
49 3
        $this->_request_data['l10n'] = $this->_l10n;
50 3
    }
51
}
52