These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * PHPMailer - PHP email creation and transport class. |
||
4 | * PHP Version 5.4 |
||
5 | * @package PHPMailer |
||
6 | * @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project |
||
7 | * @author Marcus Bointon (Synchro/coolbru) <[email protected]> |
||
8 | * @author Jim Jagielski (jimjag) <[email protected]> |
||
9 | * @author Andy Prevost (codeworxtech) <[email protected]> |
||
10 | * @author Brent R. Matzelle (original founder) |
||
11 | * @copyright 2012 - 2014 Marcus Bointon |
||
12 | * @copyright 2010 - 2012 Jim Jagielski |
||
13 | * @copyright 2004 - 2009 Andy Prevost |
||
14 | * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License |
||
15 | * @note This program is distributed in the hope that it will be useful - WITHOUT |
||
16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
||
17 | * FITNESS FOR A PARTICULAR PURPOSE. |
||
18 | */ |
||
19 | |||
20 | /** |
||
21 | * PHPMailerOAuthGoogle - Wrapper for League OAuth2 Google provider. |
||
22 | * @package PHPMailer |
||
23 | * @author @sherryl4george |
||
24 | * @author Marcus Bointon (@Synchro) <[email protected]> |
||
25 | * @link https://github.com/thephpleague/oauth2-client |
||
26 | */ |
||
27 | class PHPMailerOAuthGoogle |
||
1 ignored issue
–
show
|
|||
28 | { |
||
29 | private $oauthUserEmail = ''; |
||
30 | private $oauthRefreshToken = ''; |
||
31 | private $oauthClientId = ''; |
||
32 | private $oauthClientSecret = ''; |
||
33 | |||
34 | /** |
||
35 | * @param string $UserEmail |
||
36 | * @param string $ClientSecret |
||
37 | * @param string $ClientId |
||
38 | * @param string $RefreshToken |
||
39 | */ |
||
40 | public function __construct( |
||
41 | $UserEmail, |
||
1 ignored issue
–
show
$UserEmail does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9_]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.
Loading history...
|
|||
42 | $ClientSecret, |
||
1 ignored issue
–
show
$ClientSecret does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9_]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.
Loading history...
|
|||
43 | $ClientId, |
||
1 ignored issue
–
show
$ClientId does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9_]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.
Loading history...
|
|||
44 | $RefreshToken |
||
1 ignored issue
–
show
$RefreshToken does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9_]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.
Loading history...
|
|||
45 | ) { |
||
46 | $this->oauthClientId = $ClientId; |
||
47 | $this->oauthClientSecret = $ClientSecret; |
||
48 | $this->oauthRefreshToken = $RefreshToken; |
||
49 | $this->oauthUserEmail = $UserEmail; |
||
50 | } |
||
51 | |||
52 | private function getProvider() |
||
53 | { |
||
54 | return new League\OAuth2\Client\Provider\Google([ |
||
55 | 'clientId' => $this->oauthClientId, |
||
56 | 'clientSecret' => $this->oauthClientSecret |
||
57 | ]); |
||
58 | } |
||
59 | |||
60 | private function getGrant() |
||
61 | { |
||
62 | return new \League\OAuth2\Client\Grant\RefreshToken(); |
||
63 | } |
||
64 | |||
65 | private function getToken() |
||
66 | { |
||
67 | $provider = $this->getProvider(); |
||
68 | $grant = $this->getGrant(); |
||
69 | return $provider->getAccessToken($grant, ['refresh_token' => $this->oauthRefreshToken]); |
||
70 | } |
||
71 | |||
72 | public function getOauth64() |
||
73 | { |
||
74 | $token = $this->getToken(); |
||
75 | return base64_encode("user=" . $this->oauthUserEmail . "\001auth=Bearer " . $token . "\001\001"); |
||
76 | } |
||
77 | } |
||
78 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.