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

LaravelGmailClass::message()   A

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
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
}