LimitAdminAccessExtension::onBeforeInit()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
/**
4
 * Class LimitAdminAccessExtension.
5
 *
6
 * @property LeftAndMain $owner
7
 */
8
class LimitAdminAccessExtension extends Extension
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
9
{
10
    /**
11
     * @return mixed
12
     */
13
    public function onBeforeInit()
14
    {
15
        $access = new IpAccess($this->owner->getRequest()->getIP());
16
        if (!$access->hasAccess()) {
17
            $access->respondNoAccess($this->owner);
18
        }
19
    }
20
}
21