add more typehints
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
5133a31d3c
commit
8b01176f60
|
@ -57,6 +57,7 @@ class ApiBase {
|
||||||
* @param array $query
|
* @param array $query
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
* @return resource|string
|
* @return resource|string
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
protected function request($method, $url, array $body = [], array $query = [], array $headers = []) {
|
protected function request($method, $url, array $body = [], array $query = [], array $headers = []) {
|
||||||
$fullUrl = trim($this->instance->getFullUrl(), '/') . '/' . $url;
|
$fullUrl = trim($this->instance->getFullUrl(), '/') . '/' . $url;
|
||||||
|
|
|
@ -28,8 +28,11 @@ use OCP\Remote\ICredentials;
|
||||||
use OCP\Remote\IInstance;
|
use OCP\Remote\IInstance;
|
||||||
|
|
||||||
class ApiCollection implements IApiCollection {
|
class ApiCollection implements IApiCollection {
|
||||||
|
/** @var IInstance */
|
||||||
private $instance;
|
private $instance;
|
||||||
|
/** @var ICredentials */
|
||||||
private $credentials;
|
private $credentials;
|
||||||
|
/** @var IClientService */
|
||||||
private $clientService;
|
private $clientService;
|
||||||
|
|
||||||
public function __construct(IInstance $instance, ICredentials $credentials, IClientService $clientService) {
|
public function __construct(IInstance $instance, ICredentials $credentials, IClientService $clientService) {
|
||||||
|
|
|
@ -28,6 +28,7 @@ use OCP\Remote\ICredentials;
|
||||||
use OCP\Remote\IInstance;
|
use OCP\Remote\IInstance;
|
||||||
|
|
||||||
class ApiFactory implements IApiFactory {
|
class ApiFactory implements IApiFactory {
|
||||||
|
/** @var IClientService */
|
||||||
private $clientService;
|
private $clientService;
|
||||||
|
|
||||||
public function __construct(IClientService $clientService) {
|
public function __construct(IClientService $clientService) {
|
||||||
|
|
|
@ -39,6 +39,7 @@ class Instance implements IInstance {
|
||||||
/** @var IClientService */
|
/** @var IClientService */
|
||||||
private $clientService;
|
private $clientService;
|
||||||
|
|
||||||
|
/** @var array|null */
|
||||||
private $status;
|
private $status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,6 +94,10 @@ class Instance implements IInstance {
|
||||||
return $status['installed'] && !$status['maintenance'];
|
return $status['installed'] && !$status['maintenance'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @throws NotFoundException
|
||||||
|
*/
|
||||||
private function getStatus() {
|
private function getStatus() {
|
||||||
if ($this->status) {
|
if ($this->status) {
|
||||||
return $this->status;
|
return $this->status;
|
||||||
|
@ -120,6 +125,10 @@ class Instance implements IInstance {
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $url
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
private function downloadStatus($url) {
|
private function downloadStatus($url) {
|
||||||
try {
|
try {
|
||||||
$request = $this->clientService->newClient()->get($url);
|
$request = $this->clientService->newClient()->get($url);
|
||||||
|
|
|
@ -27,7 +27,9 @@ use OCP\ICache;
|
||||||
use OCP\Remote\IInstanceFactory;
|
use OCP\Remote\IInstanceFactory;
|
||||||
|
|
||||||
class InstanceFactory implements IInstanceFactory {
|
class InstanceFactory implements IInstanceFactory {
|
||||||
|
/** @var ICache */
|
||||||
private $cache;
|
private $cache;
|
||||||
|
/** @var IClientService */
|
||||||
private $clientService;
|
private $clientService;
|
||||||
|
|
||||||
public function __construct(ICache $cache, IClientService $clientService) {
|
public function __construct(ICache $cache, IClientService $clientService) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace OCP\Remote;
|
||||||
*/
|
*/
|
||||||
interface IInstanceFactory {
|
interface IInstanceFactory {
|
||||||
/**
|
/**
|
||||||
* @param $url
|
* @param string $url
|
||||||
* @return IInstance
|
* @return IInstance
|
||||||
*
|
*
|
||||||
* @since 13.0.0
|
* @since 13.0.0
|
||||||
|
|
Loading…
Reference in New Issue