pop_up   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 17
c 2
b 0
f 0
dl 0
loc 59
rs 10
ccs 20
cts 20
cp 1
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A get_category() 0 3 1
A get_id() 0 3 1
A will_display() 0 13 2
A __construct() 0 7 1
1
<?php
2
/**
3
 *
4
 * Advertisement management. An extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2017 phpBB Limited <https://www.phpbb.com>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace phpbb\ads\location\type;
12
13
class pop_up extends base
14
{
15
	/** @var \phpbb\request\request */
0 ignored issues
show
Bug introduced by
The type phpbb\request\request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
	protected $request;
17
	/** @var \phpbb\config\config */
0 ignored issues
show
Bug introduced by
The type phpbb\config\config was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
	protected $config;
19
	/** @var \phpbb\template\template */
0 ignored issues
show
Bug introduced by
The type phpbb\template\template was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
	protected $template;
21
22
	/**
23
	 * pop_up location constructor.
24
	 *
25
	 * @param \phpbb\user              $user     User object
26
	 * @param \phpbb\language\language $language Language object
27
	 * @param \phpbb\request\request   $request  Request object
28
	 * @param \phpbb\config\config     $config   Config object
29
	 * @param \phpbb\template\template $template Template object
30
	 */
31 26
	public function __construct(\phpbb\user $user, \phpbb\language\language $language, \phpbb\request\request $request, \phpbb\config\config $config, \phpbb\template\template $template)
0 ignored issues
show
Bug introduced by
The type phpbb\user was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The type phpbb\language\language was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
32
	{
33 26
		parent::__construct($user, $language);
34
35 26
		$this->request = $request;
36 26
		$this->config = $config;
37 26
		$this->template = $template;
38 26
	}
39
40
	/**
41
	 * {@inheritDoc}
42
	 */
43 26
	public function get_id()
44
	{
45 26
		return 'pop_up';
46
	}
47
48
	/**
49
	 * {@inheritDoc}
50
	 */
51 26
	public function get_category()
52
	{
53 26
		return self::CAT_INTERACTIVE;
54
	}
55
56
	/**
57
	 * {@inheritDoc}
58
	 */
59 8
	public function will_display()
60
	{
61 8
		if ($this->request->is_set($this->config['cookie_name'] . '_pop_up', \phpbb\request\request_interface::COOKIE))
0 ignored issues
show
Bug introduced by
The type phpbb\request\request_interface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
62 8
		{
63 1
			return false;
64
		}
65
66 7
		$this->template->assign_vars(array(
67 7
			'POP_UP_COOKIE_NAME'	=> $this->config['cookie_name'] . '_pop_up',
68 7
			'POP_UP_COOKIE_EXPIRES'	=> gmdate('D, d M Y H:i:s T', strtotime('+1 day')),
69 7
			'POP_UP_COOKIE_PATH'	=> $this->config['cookie_path'],
70 7
		));
71 7
		return true;
72
	}
73
}
74