Completed
Push — master ( 0ea243...da58d4 )
by Henry
10:25 queued 33s
created

includes/Bootstrap/Auth.php (23 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace Redaxscript\Bootstrap;
3
4
use Redaxscript\Auth as BaseAuth;
5
6
/**
7
 * children class to boot the auth
8
 *
9
 * @since 3.1.0
10
 *
11
 * @package Redaxscript
12
 * @category Bootstrap
13
 * @author Henry Ruhs
14
 */
15
16
class Auth extends BootstrapAbstract
17
{
18
	/**
19
	 * automate run
20
	 *
21
	 * @since 3.1.0
22
	 */
23
24 2
	public function autorun() : void
25
	{
26 2
		$this->_setUser();
27 2
		$this->_setPermission();
28 2
		$this->_setTable();
29 2
	}
30
31
	/**
32
	 * set the user
33
	 *
34
	 * @since 3.1.0
35
	 */
36
37 2
	protected function _setUser() : void
38
	{
39 2
		$auth = new BaseAuth($this->_request);
40 2
		$auth->init();
41
42
		/* set the registry */
43
44 2
		if ($auth->getStatus())
45
		{
46 1
			$this->_registry->set('myId', $auth->getUser('id'));
47 1
			$this->_registry->set('myName', $auth->getUser('name'));
48 1
			$this->_registry->set('myUser', $auth->getUser('user'));
49 1
			$this->_registry->set('myEmail', $auth->getUser('email'));
50 1
			$this->_registry->set('myLanguage', $auth->getUser('language'));
51 1
			$this->_registry->set('myGroups', $auth->getUser('groups'));
52
		}
53 2
	}
54
55
	/**
56
	 * set the permission
57
	 *
58
	 * @since 3.1.0
59
	 */
60
61 2
	protected function _setPermission() : void
62
	{
63 2
		$auth = new BaseAuth($this->_request);
64 2
		$auth->init();
65
66
		/* set the registry */
67
68 2
		if ($auth->getStatus())
69
		{
70 1
			$this->_registry->set('categoriesNew', $auth->getPermissionNew('categories'));
0 ignored issues
show
$auth->getPermissionNew('categories') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
71 1
			$this->_registry->set('categoriesEdit', $auth->getPermissionEdit('categories'));
0 ignored issues
show
$auth->getPermissionEdit('categories') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
72 1
			$this->_registry->set('categoriesDelete', $auth->getPermissionDelete('categories'));
0 ignored issues
show
$auth->getPermissionDelete('categories') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
73 1
			$this->_registry->set('articlesNew', $auth->getPermissionNew('articles'));
0 ignored issues
show
$auth->getPermissionNew('articles') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
74 1
			$this->_registry->set('articlesEdit', $auth->getPermissionEdit('articles'));
0 ignored issues
show
$auth->getPermissionEdit('articles') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
75 1
			$this->_registry->set('articlesDelete', $auth->getPermissionDelete('articles'));
0 ignored issues
show
$auth->getPermissionDelete('articles') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
76 1
			$this->_registry->set('extrasNew', $auth->getPermissionNew('extras'));
0 ignored issues
show
$auth->getPermissionNew('extras') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
77 1
			$this->_registry->set('extrasEdit', $auth->getPermissionEdit('extras'));
0 ignored issues
show
$auth->getPermissionEdit('extras') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
78 1
			$this->_registry->set('extrasDelete', $auth->getPermissionDelete('extras'));
0 ignored issues
show
$auth->getPermissionDelete('extras') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
79 1
			$this->_registry->set('commentsNew', $auth->getPermissionNew('comments'));
0 ignored issues
show
$auth->getPermissionNew('comments') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
80 1
			$this->_registry->set('commentsEdit', $auth->getPermissionEdit('comments'));
0 ignored issues
show
$auth->getPermissionEdit('comments') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
81 1
			$this->_registry->set('commentsDelete', $auth->getPermissionDelete('comments'));
0 ignored issues
show
$auth->getPermissionDelete('comments') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
82 1
			$this->_registry->set('groupsNew', $auth->getPermissionNew('groups'));
0 ignored issues
show
$auth->getPermissionNew('groups') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
83 1
			$this->_registry->set('groupsEdit', $auth->getPermissionEdit('groups'));
0 ignored issues
show
$auth->getPermissionEdit('groups') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
84 1
			$this->_registry->set('groupsDelete', $auth->getPermissionDelete('groups'));
0 ignored issues
show
$auth->getPermissionDelete('groups') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
85 1
			$this->_registry->set('usersNew', $auth->getPermissionNew('users'));
0 ignored issues
show
$auth->getPermissionNew('users') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
86 1
			$this->_registry->set('usersEdit', $auth->getPermissionEdit('users'));
0 ignored issues
show
$auth->getPermissionEdit('users') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
87 1
			$this->_registry->set('usersDelete', $auth->getPermissionDelete('users'));
0 ignored issues
show
$auth->getPermissionDelete('users') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
88 1
			$this->_registry->set('modulesInstall', $auth->getPermissionInstall('modules'));
0 ignored issues
show
$auth->getPermissionInstall('modules') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
89 1
			$this->_registry->set('modulesEdit', $auth->getPermissionEdit('modules'));
0 ignored issues
show
$auth->getPermissionEdit('modules') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
90 1
			$this->_registry->set('modulesUninstall', $auth->getPermissionUninstall('modules'));
0 ignored issues
show
$auth->getPermissionUninstall('modules') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
91 1
			$this->_registry->set('settingsEdit', $auth->getPermissionEdit('settings'));
0 ignored issues
show
$auth->getPermissionEdit('settings') is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
92
		}
93 2
		$this->_registry->set('filter', $auth->getFilter());
0 ignored issues
show
$auth->getFilter() is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
94 2
	}
95
96
	/**
97
	 * set the table
98
	 *
99
	 * @since 3.1.0
100
	 */
101
102 2
	protected function _setTable() : void
103
	{
104 2
		$tableParameter = $this->_registry->get('tableParameter');
105
106
		/* set the registry */
107
108 2
		$this->_registry->set('tableNew', $this->_registry->get($tableParameter . 'New'));
109 2
		$this->_registry->set('tableInstall', $this->_registry->get($tableParameter . 'Install'));
110 2
		$this->_registry->set('tableEdit', $this->_registry->get($tableParameter . 'Edit'));
111 2
		$this->_registry->set('tableDelete', $this->_registry->get($tableParameter . 'Delete'));
112 2
		$this->_registry->set('tableUninstall', $this->_registry->get($tableParameter . 'Uninstall'));
113 2
	}
114
}
115