add more typehints

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2017-10-19 13:50:27 +02:00 committed by Morris Jobke
parent 5133a31d3c
commit 8b01176f60
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
6 changed files with 17 additions and 1 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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) {

View File

@ -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);

View File

@ -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) {

View File

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