Code Duplication    Length = 20-20 lines in 2 locations

src/API/Kitsu/KitsuTrait.php 1 location

@@ 127-146 (lines=20) @@
124
	 * @param array $options
125
	 * @return array
126
	 */
127
	private function request(string $type, string $url, array $options = []): array
128
	{
129
		$logger = null;
130
		if ($this->getContainer())
131
		{
132
			$logger = $this->container->getLogger('kitsu-request');
133
		}
134
135
		$response = $this->getResponse($type, $url, $options);
136
137
		if ((int) $response->getStatus() > 299 || (int) $response->getStatus() < 200)
138
		{
139
			if ($logger)
140
			{
141
				$logger->warning('Non 200 response for api call', $response->getBody());
142
			}
143
		}
144
145
		return JSON::decode($response->getBody(), TRUE);
146
	}
147
148
	/**
149
	 * Remove some boilerplate for get requests

src/API/MAL/MALTrait.php 1 location

@@ 149-168 (lines=20) @@
146
	 * @param array $options
147
	 * @return array
148
	 */
149
	private function request(string $type, string $url, array $options = []): array
150
	{
151
		$logger = null;
152
		if ($this->getContainer())
153
		{
154
			$logger = $this->container->getLogger('mal-request');
155
		}
156
157
		$response = $this->getResponse($type, $url, $options);
158
159
		if ((int) $response->getStatus() > 299 || (int) $response->getStatus() < 200)
160
		{
161
			if ($logger)
162
			{
163
				$logger->warning('Non 200 response for api call', $response->getBody());
164
			}
165
		}
166
167
		return XML::toArray((string) $response->getBody());
168
	}
169
170
	/**
171
	 * Remove some boilerplate for get requests