OnePageHolderExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A MetaTags() 0 18 2
1
<?php
2
3
/**
4
 * Created by IntelliJ IDEA.
5
 * User: Werner
6
 * Date: 14.11.2016
7
 * Time: 14:42
8
 */
9
class OnePageHolderExtension 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...
10
{
11
    public function MetaTags(& $tags)
12
    {
13
        $request = Controller::curr()->getRequest();
14
15
        if ($currentEditPageID = $request->getVar('EditPageID')) {
16
            $origIDTag = "<meta name=\"x-page-id\" content=\"{$this->owner->ID}\" />\n";
17
            $origEditLinkTag = "<meta name=\"x-cms-edit-link\" content=\"" . $this->owner->CMSEditLink() . "\" />\n";
18
19
            $modifiedCMSEditLink = str_replace($this->owner->ID, $currentEditPageID, $this->owner->CMSEditLink());
20
21
            $newIDTag = "<meta name=\"x-page-id\" content=\"{$currentEditPageID}\" />\n";
22
            $newEditLinkTag = "<meta name=\"x-cms-edit-link\" content=\"" . $modifiedCMSEditLink . "\" />\n";
23
24
            $tags = str_replace($origIDTag, $newIDTag, $tags);
25
            $tags = str_replace($origEditLinkTag, $newEditLinkTag, $tags);
26
        }
27
28
    }
29
}
30