EmailCallback::meondatabase()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
class EmailCallback extends SocialIntegrationControllerBaseClass implements SocialIntegrationAPIInterface
0 ignored issues
show
Bug introduced by
There is at least one abstract method in this class. Maybe declare it as abstract, or implement the remaining methods: get_number_of_friends_that_can_be_retrieved, get_updates, set_number_of_friends_that_can_be_retrieved
Loading history...
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...
4
{
5
6
7
    /**
8
     * make sure to return TRUE as response if the message is sent
9
     * successfully
10
     * Sends a message from the current user to someone else in the networkd
11
     * @param Int | String | Member $to -
12
     * @param String $message - Message you are sending
13
     * @param String $link - Link to send with message - NOT USED IN EMAIL
14
     * @param Array - other variables that we include
15
     * @return Boolean - return TRUE as success
16
     */
17
    public static function send_message($to, $message, $link = "", $otherVariables = array())
18
    {
19
20
        //FROM
21
        if (!empty($otherVariables["From"])) {
22
            $from = $otherVariables["From"];
23
        } else {
24
            $from = Email::getAdminEmail();
25
        }
26
27
        //TO
28
        if ($to instanceof Member) {
29
            $to = $to->Email;
30
        }
31
        //SUBJECT
32 View Code Duplication
        if (!empty($otherVariables["Subject"])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
            $subject = $otherVariables["Subject"];
34
        } else {
35
            $subject = substr($message, 0, 30);
36
        }
37
38
        //BODY
39
        $body = $message;
40
41
        //CC
42
        if (!empty($otherVariables["CC"])) {
43
            $cc = $otherVariables["CC"];
44
        } else {
45
            $cc = "";
46
        }
47
48
        //BCC
49
        $bcc = Email::getAdminEmail();
50
51
        //SEND EMAIL
52
        $email = new Email(
53
            $from,
54
            $to,
55
            $subject,
56
            $body,
57
            $bounceHandlerURL = null,
58
            $cc,
59
            $bcc
60
        );
61
        return $email->send();
62
    }
63
64
    public static function get_list_of_friends($limit = 12, $searchString = "")
65
    {
66
        return array();
67
    }
68
69
    /**
70
     *
71
     * return Object | Null
72
     */
73
    public static function get_current_user()
74
    {
75
        return Member::currentUser();
76
    }
77
78
    public static function is_valid_user($id)
79
    {
80
        return filter_var($id, FILTER_VALIDATE_EMAIL);
81
    }
82
83
    /**
84
     * Link to login form
85
     * @param String $returnURL
86
     * @return String
87
     */
88
    public static function connect_url($returnURL = "", $existingMember = false)
89
    {
90
        $backURLString = "";
91
        if ($returnURL) {
92
            $backURLString = 'BackURL='.urlencode($returnURL);
93
        }
94
        if ($existingMember) {
95
            $tab = 'EmailLoginForm_LoginForm_tab';
96
        } else {
97
            $tab = "MemberLoginFormWithSignup_LoginForm_tab";
98
        }
99
        //$backLink = urlencode($returnURL);
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
100
        //return "Security/login/".$backLink."#".$tab;
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
101
        return "Security/login/?email=1&amp;".$backURLString."#".$tab;
102
    }
103
104
    public function meondatabase()
105
    {
106
        print_r(Member::currentUser());
107
    }
108
}
109