Test Setup Failed
Push — master ( bcd5a1...e5f8b7 )
by Daniel
02:52
created

LaravelGmailClass   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 48
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A message() 0 4 1
A user() 0 4 1
A getAuthUrl() 0 4 1
A redirect() 0 4 1
A logout() 0 5 1
1
<?php
2
3
namespace Dacastro4\LaravelGmail;
4
5
use Dacastro4\LaravelGmail\Services\Message;
6
use Illuminate\Config\Repository as Config;
7
use Illuminate\Support\Facades\Redirect;
8
9
class LaravelGmailClass extends GmailConnection
10
{
11
12
	public function __construct( Config $config )
13
	{
14
		parent::__construct( $config );
15
	}
16
17
	/**
18
	 * @return Message
19
	 */
20
	public function message()
21
	{
22
		return new Message($this);
23
	}
24
25
	/**
26
	 * Returns the Gmail user email
27
	 *
28
	 * @return \Google_Service_Gmail_Profile
29
	 */
30
	public function user()
31
	{
32
		return $this->config('email');
33
	}
34
35
	/**
36
	 * Gets the URL to authorize the user
37
	 *
38
	 * @return string
39
	 */
40
	public function getAuthUrl()
41
	{
42
		return $this->createAuthUrl();
43
	}
44
45
	public function redirect()
46
	{
47
		return Redirect::to( $this->getAuthUrl() );
48
	}
49
50
	public function logout()
51
	{
52
		$this->revokeToken();
53
		$this->deleteAccessToken();
54
	}
55
56
}