TwitterIdentifier   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A extraStatics() 0 17 1
A getTwitterButton() 0 4 1
A hasTwitter() 0 4 1
A TwitterLink() 0 7 2
1
<?php
2
3
/***
4
 * adds twitter functionality to Member
5
 *
6
 * email issue: https://dev.twitter.com/discussions/4019
7
 *
8
 *
9
 */
10
11
12
class TwitterIdentifier extends DataObjectDecorator
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
    //TwitterHandle
16
    //TwitterAccessToken
17
    public function extraStatics()
18
    {
19
        return array(
20
            'db' => array(
21
                'TwitterID' => 'Varchar',
22
                'TwitterToken' => 'Varchar(100)',
23
                'TwitterSecret' => 'Varchar(100)',
24
                'TwitterPicture' => 'Text',
25
                'TwitterName' => 'Varchar(255)',
26
                'TwitterScreenName' => 'Varchar(255)'
27
            ),
28
            'indexes' => array(
29
                'TwitterID' => true,
30
                'TwitterScreenName' => true
31
            )
32
        );
33
    }
34
35
    /**
36
     * connect and disconnect button
37
     * @return Object (IsConnected, Link, ConnectedName, ConnectedImageURL)
38
     */
39
    public function getTwitterButton($backURL = "")
40
    {
41
        return TwitterCallback::get_login_button($backURL, $this->owner);
42
    }
43
44
    /**
45
     * Does the user have (or had) a connection with twitter?
46
     * @return Boolean
47
     */
48
    public function hasTwitter()
49
    {
50
        return (bool)($this->owner->TwitterID);
51
    }
52
53
    /**
54
     * link to profile
55
     * @return String
56
     */
57
    public function TwitterLink()
58
    {
59
        if ($this->owner->TwitterID) {
60
            return "https://twitter.com/account/redirect_by_id?id=".$this->owner->TwitterID;
61
        }
62
        return "";
63
    }
64
}
65