1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* The MIT License (MIT) |
4
|
|
|
* |
5
|
|
|
* Copyright (c) 2016 Haridarshan Gorana |
6
|
|
|
* |
7
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
8
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
9
|
|
|
* in the Software without restriction, including without limitation the rights |
10
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
11
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
12
|
|
|
* furnished to do so, subject to the following conditions: |
13
|
|
|
* |
14
|
|
|
* The above copyright notice and this permission notice shall be included in all |
15
|
|
|
* copies or substantial portions of the Software. |
16
|
|
|
* |
17
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
18
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
19
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
20
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
21
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
22
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
23
|
|
|
* SOFTWARE. |
24
|
|
|
* |
25
|
|
|
*/ |
26
|
|
|
namespace Haridarshan\Instagram; |
27
|
|
|
|
28
|
|
|
use Haridarshan\Instagram\Exceptions\InstagramException; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* InstagramApp class |
32
|
|
|
* |
33
|
|
|
* @library instagram-php |
34
|
|
|
* @license https://opensource.org/licenses/MIT MIT |
35
|
|
|
* @link http://github.com/haridarshan/instagram-php Class Documentation |
36
|
|
|
* @link http://instagram.com/developer/ API Documentation |
37
|
|
|
* @author Haridarshan Gorana <[email protected]> |
38
|
|
|
* @since September 03, 2016 |
39
|
|
|
* @copyright Haridarshan Gorana |
40
|
|
|
* @version 2.2.2 |
41
|
|
|
*/ |
42
|
|
|
class InstagramApp |
43
|
|
|
{ |
44
|
|
|
/** |
45
|
|
|
* @var string Instagram App ID. |
46
|
|
|
*/ |
47
|
|
|
protected $id; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var string Instagram App Secret. |
51
|
|
|
*/ |
52
|
|
|
protected $secret; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @param string $id |
56
|
|
|
* @param string $secret |
57
|
|
|
* |
58
|
|
|
* @throws InstagramException |
59
|
|
|
*/ |
60
|
|
|
public function __construct($id, $secret) |
61
|
|
|
{ |
62
|
|
|
if (!is_string($id)) { |
63
|
|
|
throw new InstagramException('The "client_id" must be formatted as a string.'); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
if (!is_string($secret)) { |
67
|
|
|
throw new InstagramException('The "client_secret" must be formatted as a string.'); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
$this->id = $id; |
71
|
|
|
$this->secret = $secret; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Returns the app ID. |
76
|
|
|
* |
77
|
|
|
* @return string |
78
|
|
|
*/ |
79
|
|
|
public function getId() |
80
|
|
|
{ |
81
|
|
|
return $this->id; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Returns the app secret. |
86
|
|
|
* |
87
|
|
|
* @return string |
88
|
|
|
*/ |
89
|
|
|
public function getSecret() |
90
|
|
|
{ |
91
|
|
|
return $this->secret; |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|