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

LaravelGmailClass::__call()   B

Complexity

Conditions 4
Paths 5

Size

Total Lines 22
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 8.9197
c 0
b 0
f 0
cc 4
eloc 15
nc 5
nop 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A LaravelGmailClass::user() 0 4 1
A LaravelGmailClass::getAuthUrl() 0 4 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
}