polish, use Php 8 stuff
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
Родитель
8bdcba2918
Коммит
e1c08ad691
|
@ -28,49 +28,16 @@ use OCP\PreConditionNotMetException;
|
|||
|
||||
class ConfigController extends Controller {
|
||||
|
||||
/**
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
/**
|
||||
* @var IURLGenerator
|
||||
*/
|
||||
private $urlGenerator;
|
||||
/**
|
||||
* @var IL10N
|
||||
*/
|
||||
private $l;
|
||||
/**
|
||||
* @var GithubAPIService
|
||||
*/
|
||||
private $githubAPIService;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $userId;
|
||||
/**
|
||||
* @var IInitialState
|
||||
*/
|
||||
private $initialStateService;
|
||||
private GithubReferenceProvider $githubReferenceProvider;
|
||||
|
||||
public function __construct(string $appName,
|
||||
IRequest $request,
|
||||
IConfig $config,
|
||||
IURLGenerator $urlGenerator,
|
||||
IL10N $l,
|
||||
IInitialState $initialStateService,
|
||||
GithubAPIService $githubAPIService,
|
||||
GithubReferenceProvider $githubReferenceProvider,
|
||||
?string $userId) {
|
||||
private IConfig $config,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private IL10N $l,
|
||||
private IInitialState $initialStateService,
|
||||
private GithubAPIService $githubAPIService,
|
||||
private GithubReferenceProvider $githubReferenceProvider,
|
||||
private ?string $userId) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->config = $config;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->l = $l;
|
||||
$this->githubAPIService = $githubAPIService;
|
||||
$this->userId = $userId;
|
||||
$this->initialStateService = $initialStateService;
|
||||
$this->githubReferenceProvider = $githubReferenceProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,22 +21,11 @@ use OCA\Github\Service\GithubAPIService;
|
|||
|
||||
class GithubAPIController extends Controller {
|
||||
|
||||
/**
|
||||
* @var GithubAPIService
|
||||
*/
|
||||
private $githubAPIService;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $userId;
|
||||
|
||||
public function __construct(string $appName,
|
||||
IRequest $request,
|
||||
GithubAPIService $githubAPIService,
|
||||
?string $userId) {
|
||||
private GithubAPIService $githubAPIService,
|
||||
private ?string $userId) {
|
||||
parent::__construct($appName, $request);
|
||||
$this->githubAPIService = $githubAPIService;
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,41 +40,12 @@ use OCA\Github\AppInfo\Application;
|
|||
|
||||
class GithubWidget implements IAPIWidget, IButtonWidget, IIconWidget, IOptionWidget {
|
||||
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
/**
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
/**
|
||||
* @var IInitialState
|
||||
*/
|
||||
private $initialStateService;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $userId;
|
||||
/**
|
||||
* @var GithubAPIService
|
||||
*/
|
||||
private $githubAPIService;
|
||||
/**
|
||||
* @var IURLGenerator
|
||||
*/
|
||||
private $urlGenerator;
|
||||
|
||||
public function __construct(IL10N $l10n,
|
||||
IConfig $config,
|
||||
IURLGenerator $urlGenerator,
|
||||
IInitialState $initialStateService,
|
||||
GithubAPIService $githubAPIService,
|
||||
?string $userId) {
|
||||
$this->l10n = $l10n;
|
||||
$this->config = $config;
|
||||
$this->initialStateService = $initialStateService;
|
||||
$this->userId = $userId;
|
||||
$this->githubAPIService = $githubAPIService;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
public function __construct(private IL10N $l10n,
|
||||
private IConfig $config,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private IInitialState $initialStateService,
|
||||
private GithubAPIService $githubAPIService,
|
||||
private ?string $userId) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,25 +36,12 @@ class GithubCodeReferenceProvider extends ADiscoverableReferenceProvider {
|
|||
|
||||
private const RICH_OBJECT_TYPE = Application::APP_ID . '_code_permalink';
|
||||
|
||||
private GithubAPIService $githubAPIService;
|
||||
private ?string $userId;
|
||||
private IConfig $config;
|
||||
private ReferenceManager $referenceManager;
|
||||
private IL10N $l10n;
|
||||
private IURLGenerator $urlGenerator;
|
||||
|
||||
public function __construct(GithubAPIService $githubAPIService,
|
||||
IConfig $config,
|
||||
IL10N $l10n,
|
||||
IURLGenerator $urlGenerator,
|
||||
ReferenceManager $referenceManager,
|
||||
?string $userId) {
|
||||
$this->githubAPIService = $githubAPIService;
|
||||
$this->userId = $userId;
|
||||
$this->config = $config;
|
||||
$this->referenceManager = $referenceManager;
|
||||
$this->l10n = $l10n;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
public function __construct(private GithubAPIService $githubAPIService,
|
||||
private IConfig $config,
|
||||
private IL10N $l10n,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private ReferenceManager $referenceManager,
|
||||
private ?string $userId) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,25 +40,12 @@ class GithubReferenceProvider extends ADiscoverableReferenceProvider implements
|
|||
|
||||
private const RICH_OBJECT_TYPE = Application::APP_ID . '_issue_pr';
|
||||
|
||||
private GithubAPIService $githubAPIService;
|
||||
private ?string $userId;
|
||||
private IConfig $config;
|
||||
private ReferenceManager $referenceManager;
|
||||
private IL10N $l10n;
|
||||
private IURLGenerator $urlGenerator;
|
||||
|
||||
public function __construct(GithubAPIService $githubAPIService,
|
||||
IConfig $config,
|
||||
IL10N $l10n,
|
||||
IURLGenerator $urlGenerator,
|
||||
ReferenceManager $referenceManager,
|
||||
?string $userId) {
|
||||
$this->githubAPIService = $githubAPIService;
|
||||
$this->userId = $userId;
|
||||
$this->config = $config;
|
||||
$this->referenceManager = $referenceManager;
|
||||
$this->l10n = $l10n;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
public function __construct(private GithubAPIService $githubAPIService,
|
||||
private IConfig $config,
|
||||
private IL10N $l10n,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private ReferenceManager $referenceManager,
|
||||
private ?string $userId) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,45 +34,15 @@ use OCP\IUser;
|
|||
use OCP\Search\IProvider;
|
||||
use OCP\Search\ISearchQuery;
|
||||
use OCP\Search\SearchResult;
|
||||
use OCP\Search\SearchResultEntry;
|
||||
|
||||
class GithubSearchIssuesProvider implements IProvider {
|
||||
|
||||
/** @var IAppManager */
|
||||
private $appManager;
|
||||
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
/**
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
/**
|
||||
* @var GithubAPIService
|
||||
*/
|
||||
private $service;
|
||||
|
||||
/**
|
||||
* CospendSearchProvider constructor.
|
||||
*
|
||||
* @param IAppManager $appManager
|
||||
* @param IL10N $l10n
|
||||
* @param IConfig $config
|
||||
* @param IURLGenerator $urlGenerator
|
||||
* @param GithubAPIService $service
|
||||
*/
|
||||
public function __construct(IAppManager $appManager,
|
||||
IL10N $l10n,
|
||||
IConfig $config,
|
||||
IURLGenerator $urlGenerator,
|
||||
GithubAPIService $service) {
|
||||
$this->appManager = $appManager;
|
||||
$this->l10n = $l10n;
|
||||
$this->config = $config;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->service = $service;
|
||||
public function __construct(private IAppManager $appManager,
|
||||
private IL10N $l10n,
|
||||
private IConfig $config,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private GithubAPIService $service) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,8 +99,8 @@ class GithubSearchIssuesProvider implements IProvider {
|
|||
$issues = $searchResult['items'];
|
||||
}
|
||||
|
||||
$formattedResults = array_map(function (array $entry): GithubSearchResultEntry {
|
||||
return new GithubSearchResultEntry(
|
||||
$formattedResults = array_map(function (array $entry): SearchResultEntry {
|
||||
return new SearchResultEntry(
|
||||
$this->getThumbnailUrl($entry),
|
||||
$this->getMainText($entry),
|
||||
$this->getSubline($entry),
|
||||
|
|
|
@ -34,45 +34,15 @@ use OCP\IUser;
|
|||
use OCP\Search\IProvider;
|
||||
use OCP\Search\ISearchQuery;
|
||||
use OCP\Search\SearchResult;
|
||||
use OCP\Search\SearchResultEntry;
|
||||
|
||||
class GithubSearchReposProvider implements IProvider {
|
||||
|
||||
/** @var IAppManager */
|
||||
private $appManager;
|
||||
|
||||
/** @var IL10N */
|
||||
private $l10n;
|
||||
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
/**
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
/**
|
||||
* @var GithubAPIService
|
||||
*/
|
||||
private $service;
|
||||
|
||||
/**
|
||||
* CospendSearchProvider constructor.
|
||||
*
|
||||
* @param IAppManager $appManager
|
||||
* @param IL10N $l10n
|
||||
* @param IConfig $config
|
||||
* @param IURLGenerator $urlGenerator
|
||||
* @param GithubAPIService $service
|
||||
*/
|
||||
public function __construct(IAppManager $appManager,
|
||||
IL10N $l10n,
|
||||
IConfig $config,
|
||||
IURLGenerator $urlGenerator,
|
||||
GithubAPIService $service) {
|
||||
$this->appManager = $appManager;
|
||||
$this->l10n = $l10n;
|
||||
$this->config = $config;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->service = $service;
|
||||
public function __construct(private IAppManager $appManager,
|
||||
private IL10N $l10n,
|
||||
private IConfig $config,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private GithubAPIService $service) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,8 +99,8 @@ class GithubSearchReposProvider implements IProvider {
|
|||
$repos = $searchResult['items'];
|
||||
}
|
||||
|
||||
$formattedResults = array_map(function (array $entry): GithubSearchResultEntry {
|
||||
return new GithubSearchResultEntry(
|
||||
$formattedResults = array_map(function (array $entry): SearchResultEntry {
|
||||
return new SearchResultEntry(
|
||||
$this->getThumbnailUrl($entry),
|
||||
$this->getMainText($entry),
|
||||
$this->getSubline($entry),
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2020, Julien Veyssier
|
||||
*
|
||||
* @author Julien Veyssier <eneiluj@posteo.net>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
namespace OCA\Github\Search;
|
||||
|
||||
use OCP\Search\SearchResultEntry;
|
||||
|
||||
class GithubSearchResultEntry extends SearchResultEntry {
|
||||
}
|
|
@ -18,6 +18,7 @@ use GuzzleHttp\Exception\ClientException;
|
|||
use GuzzleHttp\Exception\ServerException;
|
||||
use OCA\Github\AppInfo\Application;
|
||||
use OCP\Dashboard\Model\WidgetItem;
|
||||
use OCP\Http\Client\IClient;
|
||||
use OCP\IConfig;
|
||||
use OCP\IL10N;
|
||||
use OCP\IURLGenerator;
|
||||
|
@ -26,45 +27,21 @@ use Psr\Log\LoggerInterface;
|
|||
use OCP\Http\Client\IClientService;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Service to make requests to GitHub v3 (JSON) API
|
||||
*/
|
||||
class GithubAPIService {
|
||||
/**
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
private $logger;
|
||||
/**
|
||||
* @var IL10N
|
||||
*/
|
||||
private $l10n;
|
||||
/**
|
||||
* @var \OCP\Http\Client\IClient
|
||||
*/
|
||||
private $client;
|
||||
/**
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
/**
|
||||
* @var IURLGenerator
|
||||
*/
|
||||
private $urlGenerator;
|
||||
private IUserManager $userManager;
|
||||
|
||||
/**
|
||||
* Service to make requests to GitHub v3 (JSON) API
|
||||
*/
|
||||
public function __construct (string $appName,
|
||||
LoggerInterface $logger,
|
||||
IL10N $l10n,
|
||||
IConfig $config,
|
||||
IURLGenerator $urlGenerator,
|
||||
IUserManager $userManager,
|
||||
IClientService $clientService) {
|
||||
$this->logger = $logger;
|
||||
$this->l10n = $l10n;
|
||||
private IClient $client;
|
||||
|
||||
public function __construct (string $appName,
|
||||
private LoggerInterface $logger,
|
||||
private IL10N $l10n,
|
||||
private IConfig $config,
|
||||
private IURLGenerator $urlGenerator,
|
||||
private IUserManager $userManager,
|
||||
IClientService $clientService) {
|
||||
$this->client = $clientService->newClient();
|
||||
$this->config = $config;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->userManager = $userManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,13 +9,8 @@ use OCA\Github\AppInfo\Application;
|
|||
|
||||
class Admin implements ISettings {
|
||||
|
||||
private IConfig $config;
|
||||
private IInitialState $initialStateService;
|
||||
|
||||
public function __construct(IConfig $config,
|
||||
IInitialState $initialStateService) {
|
||||
$this->config = $config;
|
||||
$this->initialStateService = $initialStateService;
|
||||
public function __construct(private IConfig $config,
|
||||
private IInitialState $initialStateService) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,16 +7,8 @@ use OCP\Settings\IIconSection;
|
|||
|
||||
class AdminSection implements IIconSection {
|
||||
|
||||
/** @var IL10N */
|
||||
private $l;
|
||||
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
|
||||
public function __construct(IURLGenerator $urlGenerator,
|
||||
IL10N $l) {
|
||||
$this->l = $l;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
public function __construct(private IURLGenerator $urlGenerator,
|
||||
private IL10N $l) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,25 +9,9 @@ use OCA\Github\AppInfo\Application;
|
|||
|
||||
class Personal implements ISettings {
|
||||
|
||||
/**
|
||||
* @var IConfig
|
||||
*/
|
||||
private $config;
|
||||
/**
|
||||
* @var IInitialState
|
||||
*/
|
||||
private $initialStateService;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $userId;
|
||||
|
||||
public function __construct(IConfig $config,
|
||||
IInitialState $initialStateService,
|
||||
?string $userId) {
|
||||
$this->config = $config;
|
||||
$this->initialStateService = $initialStateService;
|
||||
$this->userId = $userId;
|
||||
public function __construct(private IConfig $config,
|
||||
private IInitialState $initialStateService,
|
||||
private ?string $userId) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,16 +7,8 @@ use OCP\Settings\IIconSection;
|
|||
|
||||
class PersonalSection implements IIconSection {
|
||||
|
||||
/** @var IL10N */
|
||||
private $l;
|
||||
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
|
||||
public function __construct(IURLGenerator $urlGenerator,
|
||||
IL10N $l) {
|
||||
$this->l = $l;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
public function __construct(private IURLGenerator $urlGenerator,
|
||||
private IL10N $l) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче