Completed
Push — master ( 5505b6...fd34cf )
by Sergey
11:27
created
src/Api/Endpoints/Endpoint.php 1 patch
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -6,125 +6,125 @@
 block discarded – undo
6 6
 
7 7
 class Endpoint
8 8
 {
9
-    /**
10
-     * @var array
11
-     */
12
-    protected $rateLimitInfo;
13
-
14
-    /**
15
-     * @var array
16
-     */
17
-    protected $allowedMethods = [
18
-        'getById',
19
-        'getAll',
20
-        'create',
21
-        'update',
22
-        'delete',
23
-    ];
24
-
25
-    /**
26
-     * @var string
27
-     */
28
-    protected $endpoint;
29
-
30
-    /**
31
-     * @var array
32
-     */
33
-    protected $headers = [];
34
-
35
-    /**
36
-     * @var HttpClient
37
-     */
38
-    protected $http;
39
-
40
-    /**
41
-     * @var string
42
-     */
43
-    protected $organizationId;
44
-
45
-    /**
46
-     * @param HttpClient $http
47
-     */
48
-    public function __construct(HttpClient $http)
49
-    {
50
-        $this->http = $http;
51
-    }
52
-
53
-    /**
54
-     * @param string $verb
55
-     * @return string
56
-     */
57
-    public function makeRequestUrl($verb = '')
58
-    {
59
-        return "https://favro.com/api/v1/{$this->endpoint}/$verb";
60
-    }
61
-
62
-    /**
63
-     * @param string $method
64
-     * @return bool
65
-     */
66
-    public function isMethodAllowed($method)
67
-    {
68
-        return in_array($method, $this->allowedMethods);
69
-    }
70
-
71
-    /**
72
-     * @return HttpClient
73
-     */
74
-    public function getHttp()
75
-    {
76
-        return $this->http;
77
-    }
78
-
79
-    /**
80
-     * @param array $params
81
-     * @return array
82
-     */
83
-    public function getAll(array $params = [])
84
-    {
85
-        return $this
86
-            ->getHttp()
87
-            ->get(
88
-                $this->makeRequestUrl(),
89
-                $params,
90
-                $this->getHeaders()
91
-            );
92
-    }
93
-
94
-    /**
95
-     * @param string $id
96
-     * @return array
97
-     */
98
-    public function getById($id)
99
-    {
100
-        return $this
101
-            ->getHttp()
102
-            ->get(
103
-                $this->makeRequestUrl($id),
104
-                [],
105
-                $this->getHeaders()
106
-            );
107
-    }
108
-
109
-    /**
110
-     * @return array
111
-     */
112
-    public function getHeaders()
113
-    {
114
-        return array_merge(
115
-            ['organizationId' => $this->organizationId],
116
-            $this->headers
117
-        );
118
-    }
119
-
120
-    /**
121
-     * @param string $organizationId
122
-     * @return $this
123
-     */
124
-    public function setOrganizationId($organizationId)
125
-    {
126
-        $this->organizationId = $organizationId;
127
-
128
-        return $this;
129
-    }
9
+	/**
10
+	 * @var array
11
+	 */
12
+	protected $rateLimitInfo;
13
+
14
+	/**
15
+	 * @var array
16
+	 */
17
+	protected $allowedMethods = [
18
+		'getById',
19
+		'getAll',
20
+		'create',
21
+		'update',
22
+		'delete',
23
+	];
24
+
25
+	/**
26
+	 * @var string
27
+	 */
28
+	protected $endpoint;
29
+
30
+	/**
31
+	 * @var array
32
+	 */
33
+	protected $headers = [];
34
+
35
+	/**
36
+	 * @var HttpClient
37
+	 */
38
+	protected $http;
39
+
40
+	/**
41
+	 * @var string
42
+	 */
43
+	protected $organizationId;
44
+
45
+	/**
46
+	 * @param HttpClient $http
47
+	 */
48
+	public function __construct(HttpClient $http)
49
+	{
50
+		$this->http = $http;
51
+	}
52
+
53
+	/**
54
+	 * @param string $verb
55
+	 * @return string
56
+	 */
57
+	public function makeRequestUrl($verb = '')
58
+	{
59
+		return "https://favro.com/api/v1/{$this->endpoint}/$verb";
60
+	}
61
+
62
+	/**
63
+	 * @param string $method
64
+	 * @return bool
65
+	 */
66
+	public function isMethodAllowed($method)
67
+	{
68
+		return in_array($method, $this->allowedMethods);
69
+	}
70
+
71
+	/**
72
+	 * @return HttpClient
73
+	 */
74
+	public function getHttp()
75
+	{
76
+		return $this->http;
77
+	}
78
+
79
+	/**
80
+	 * @param array $params
81
+	 * @return array
82
+	 */
83
+	public function getAll(array $params = [])
84
+	{
85
+		return $this
86
+			->getHttp()
87
+			->get(
88
+				$this->makeRequestUrl(),
89
+				$params,
90
+				$this->getHeaders()
91
+			);
92
+	}
93
+
94
+	/**
95
+	 * @param string $id
96
+	 * @return array
97
+	 */
98
+	public function getById($id)
99
+	{
100
+		return $this
101
+			->getHttp()
102
+			->get(
103
+				$this->makeRequestUrl($id),
104
+				[],
105
+				$this->getHeaders()
106
+			);
107
+	}
108
+
109
+	/**
110
+	 * @return array
111
+	 */
112
+	public function getHeaders()
113
+	{
114
+		return array_merge(
115
+			['organizationId' => $this->organizationId],
116
+			$this->headers
117
+		);
118
+	}
119
+
120
+	/**
121
+	 * @param string $organizationId
122
+	 * @return $this
123
+	 */
124
+	public function setOrganizationId($organizationId)
125
+	{
126
+		$this->organizationId = $organizationId;
127
+
128
+		return $this;
129
+	}
130 130
 }
131 131
\ No newline at end of file
Please login to merge, or discard this patch.