updateMetadata()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 19
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 19
rs 9.2
cc 4
eloc 7
nc 4
nop 3
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