setFacebookApplicationSecret()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
//require_once "facebook.php";
4
5
class FacebookCredentials extends Page
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...
6
{
7
    public static $db = array(
8
    'BulkTitle' => 'Varchar',
9
    'BulkCaption' => 'Varchar',
10
    'BulkCopyright' => 'Varchar',
11
    'BulkLicense' => 'Varchar',
12
    'FacebookAlbumID' => 'Varchar',
13
  );
0 ignored issues
show
Coding Style introduced by
It seems like the identation of this line is off (expected at least 4 spaces, but found 2).
Loading history...
14
15
  // facebook information
16
17
  // the id of the facebook application
18
  protected static $facebook_application_id = null;
0 ignored issues
show
Coding Style introduced by
It seems like the identation of this line is off (expected at least 4 spaces, but found 2).
Loading history...
19
20
  // the secret of the facebook application
21
  protected static $facebook_application_secret = null;
0 ignored issues
show
Coding Style introduced by
It seems like the identation of this line is off (expected at least 4 spaces, but found 2).
Loading history...
22
23
  // user id to search
24
  protected static $facebook_user_id = null;
0 ignored issues
show
Coding Style introduced by
It seems like the identation of this line is off (expected at least 4 spaces, but found 2).
Loading history...
25
26
    public static $has_many = array(
27
    'AttachedFiles' => 'ImageFile',
28
  );
0 ignored issues
show
Coding Style introduced by
It seems like the identation of this line is off (expected at least 4 spaces, but found 2).
Loading history...
29
30
    public static $has_one = array(
31
      'CoverPhoto' => 'Image',
32
   );
0 ignored issues
show
Coding Style introduced by
It seems like the identation of this line is off (expected at least 4 spaces, but found 3).
Loading history...
33
34
  //Uncle Cheese hack from http://silverstripe.org/data-model-questions/show/6805 << to detect multiple calls to on after write or on before write
35
  public static $has_written = false;
0 ignored issues
show
Coding Style introduced by
It seems like the identation of this line is off (expected at least 4 spaces, but found 2).
Loading history...
36
37
    public function CanUseFacebook()
0 ignored issues
show
Coding Style introduced by
Method name "FacebookCredentials::CanUseFacebook" is not in camel caps format
Loading history...
38
    {
39
        $result = (self::$facebook_application_id != null);
40
        $result = $result && (self::$facebook_application_secret != null);
41
        $result = $result && (self::$facebook_user_id != null);
42
43
        return $result;
44
    }
45
46
    public static function setFacebookApplicationID($new_app_id)
47
    {
48
        return self::$facebook_application_id = $new_app_id;
49
    }
50
51
    public static function setFacebookApplicationSecret($new_sec)
52
    {
53
        return self::$facebook_application_secret = $new_sec;
54
    }
55
56
    public static function setFacebookUserID($new_user_id)
57
    {
58
        return self::$facebook_user_id = $new_user_id;
59
    }
60
61
    public static function getFacebookApplicationID()
62
    {
63
        $config = SiteConfig::current_site_config();
64
65
        return $config->getOGApplicationID();
66
    }
67
68
    public static function getFacebookApplicationSecret()
69
    {
70
        return self::$facebook_application_secret;
71
    }
72
73
    public static function getFacebookUserID()
74
    {
75
        $config = SiteConfig::current_site_config();
76
77
        return $config->getOGAdminID();
78
    }
79
}
80