SEO_FacebookDomainInsights_SiteTree_DataExtension   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 4
c 4
b 0
f 0
lcom 0
cbo 1
dl 0
loc 48
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateMetadata() 0 19 4
1
<?php
2
3
/**
4
 * Adds Facebook Domain Insights output to SiteTree.
5
 *
6
 * @package silverstripe-seo
7
 * @subpackage facebook-domain-insights
8
 * @author Andrew Gerber <[email protected]>
9
 * @version 1.0.0
10
 *
11
 */
12
class SEO_FacebookDomainInsights_SiteTree_DataExtension extends DataExtension
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...
13
{
14
15
16
    /* Overload Model
17
    ------------------------------------------------------------------------------*/
18
19
    // none
20
21
22
    /* Overload Methods
23
    ------------------------------------------------------------------------------*/
24
25
    // none
26
27
28
    /* Template Methods
29
    ------------------------------------------------------------------------------*/
30
31
    /**
32
     * @param SiteConfig $config
33
     * @param SiteTree $owner
34
     * @param string $metadata
35
     *
36
     * @return void
37
     *
38
     */
39
    public function updateMetadata(SiteConfig $config, SiteTree $owner, &$metadata)
40
    {
41
42
        // Facebook App ID
43
        if ($config->FacebookAppID) {
44
45
            $metadata .= $owner->MarkupComment('Facebook Insights');
46
            $metadata .= $owner->MarkupFacebook('fb:app_id', $config->FacebookAppID, false);
47
48
            // Admins (if App ID)
49
            foreach ($config->FacebookAdmins() as $admin) {
50
                if ($admin->FacebookProfileID) {
51
                    $metadata .= $owner->MarkupFacebook('fb:admins', $admin->FacebookProfileID, false);
52
                }
53
            }
54
55
        }
56
57
    }
58
59
}
60