Completed
Push — master ( 00e474...9d3fbd )
by Michael
04:26
created

Oledrion_sms::getSmsGatewayFullClassPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * oledrion
14
 *
15
 * @copyright   {@link http://xoops.org/ XOOPS Project}
16
 * @license     {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
17
 * @author      Hossein Azizabadi ([email protected])
18
 */
19
20
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% 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...
21
22
/*
0 ignored issues
show
Unused Code Comprehensibility introduced by
57% 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...
23
$information = array();
24
$information['to'] = '9365965795';
25
$information['text'] = 'ewrewr we sdf sdfdsf sdfasda sd asd asd';
26
$sms = Oledrion_sms::sendSms($information);
27
*/
28
29
class Oledrion_sms
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...
30
{
31
    /**
32
     *
33
     * @return string
34
     */
35
    public static function getSmsGateway()
36
    {
37
        return OLEDRION_SMS_GATEWAY;
38
    }
39
40
    /**
41
     * @param  string $smsGatewayName
42
     * @return string
43
     */
44
    public static function getSmsGatewayPath($smsGatewayName)
45
    {
46
        return OLEDRION_CLASS_PATH . 'sms' . '/' . $smsGatewayName;
47
    }
48
49
    /**
50
     * @param  string $smsGatewayName
51
     * @return string
52
     */
53
    public static function getSmsGatewayFullClassPath($smsGatewayName)
54
    {
55
        $smsGatewayPath = self::getSmsGatewayPath($smsGatewayName);
56
57
        return $smsGatewayPath . '/' . 'sms.php';
58
    }
59
60
    /**
61
     * @param string $smsGatewayName
62
     */
63
    public static function includeSmsGatewayClass($smsGatewayName)
64
    {
65
        $smsGatewayClassPath = self::getSmsGatewayFullClassPath($smsGatewayName);
66
        require_once $smsGatewayClassPath;
67
    }
68
69
    /**
70
     * @param  string $smsGatewayName
71
     * @return array
72
     */
73
    public static function getSmsGatewayOption($smsGatewayName)
74
    {
75
        $option         = array();
76
        $smsGatewayPath = self::getSmsGatewayPath($smsGatewayName);
77
        require_once $smsGatewayPath . '/' . 'option.php';
78
79
        return $option;
80
    }
81
82
    /**
83
     * @param  array $information
84
     * @return string
85
     * @internal param string $smsGatewayName
86
     */
87
    public static function sendSms($information = array())
88
    {
89
        $smsGatewayName = self::getSmsGateway();
90
        $option         = self::getSmsGatewayOption($smsGatewayName);
91
        self::includeSmsGatewayClass($smsGatewayName);
92
93
        return sms::sendSms($information, $option);
94
    }
95
}
96