Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
contact_admin_info
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 get_max_id
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 get_records_by_range
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
1 / 1
1
 save_record
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14namespace phpbb\textreparser\plugins;
15
16class contact_admin_info extends \phpbb\textreparser\base
17{
18    /**
19    * @var \phpbb\config\db_text
20    */
21    protected $config_text;
22
23    /**
24    * Constructor
25    *
26    * @param \phpbb\config\db_text $config_text
27    */
28    public function __construct(\phpbb\config\db_text $config_text)
29    {
30        $this->config_text = $config_text;
31    }
32
33    /**
34    * {@inheritdoc}
35    */
36    public function get_max_id()
37    {
38        return 1;
39    }
40
41    /**
42    * {@inheritdoc}
43    */
44    protected function get_records_by_range($min_id, $max_id)
45    {
46        $values = $this->config_text->get_array(array(
47            'contact_admin_info',
48            'contact_admin_info_uid',
49            'contact_admin_info_flags',
50        ));
51
52        return array(array(
53            'id'               => 1,
54            'text'             => $values['contact_admin_info'],
55            'bbcode_uid'       => $values['contact_admin_info_uid'],
56            'enable_bbcode'    => $values['contact_admin_info_flags'] & OPTION_FLAG_BBCODE,
57            'enable_magic_url' => $values['contact_admin_info_flags'] & OPTION_FLAG_LINKS,
58            'enable_smilies'   => $values['contact_admin_info_flags'] & OPTION_FLAG_SMILIES,
59        ));
60    }
61
62    /**
63    * {@inheritdoc}
64    */
65    protected function save_record(array $record)
66    {
67        $this->config_text->set('contact_admin_info', $record['text']);
68    }
69}