add constructor property promotion
add return type of methods
This commit is contained in:
parent
05c35b9a63
commit
7c5654f3bc
14 changed files with 77 additions and 387 deletions
|
|
@ -19,7 +19,6 @@
|
|||
namespace OCA\SideMenu\Controller;
|
||||
|
||||
use OC;
|
||||
use OC\App\AppStore\Fetcher\CategoryFetcher;
|
||||
use OC\URLGenerator;
|
||||
use OCA\SideMenu\Service\AppRepository;
|
||||
use OCA\SideMenu\Service\CategoryRepository;
|
||||
|
|
@ -32,57 +31,24 @@ use OCP\L10N\IFactory;
|
|||
|
||||
class NavController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var ConfigProxy
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var AppRepository
|
||||
*/
|
||||
protected $appRepository;
|
||||
|
||||
/**
|
||||
* @var IFactory
|
||||
*/
|
||||
protected $l10nFactory;
|
||||
|
||||
/**
|
||||
* @var CategoryFetcher
|
||||
*/
|
||||
protected $categoryFetcher;
|
||||
|
||||
/**
|
||||
* @var URLGenerator
|
||||
*/
|
||||
protected $router;
|
||||
|
||||
public function __construct(
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
ConfigProxy $config,
|
||||
AppRepository $appRepository,
|
||||
CategoryRepository $categoryRepository,
|
||||
URLGenerator $router,
|
||||
IFactory $l10nFactory
|
||||
protected ConfigProxy $config,
|
||||
protected AppRepository $appRepository,
|
||||
protected CategoryRepository $categoryRepository,
|
||||
protected URLGenerator $router,
|
||||
protected IFactory $l10nFactory
|
||||
) {
|
||||
parent::__construct($appName, $request);
|
||||
|
||||
$this->config = $config;
|
||||
$this->appRepository = $appRepository;
|
||||
$this->categoryRepository = $categoryRepository;
|
||||
$this->l10nFactory = $l10nFactory;
|
||||
$this->router = $router;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
* @PublicPage
|
||||
*
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function items()
|
||||
public function items(): JSONResponse
|
||||
{
|
||||
$user = OC::$server[IUserSession::class]->getUser();
|
||||
$items = [];
|
||||
|
|
@ -189,11 +155,11 @@ class NavController extends Controller
|
|||
|
||||
usort($items, function ($a, $b) use ($categoriesLabels) {
|
||||
foreach ($categoriesLabels as $key => $value) {
|
||||
if ($a['categoryId'] === 'other') {
|
||||
if ('other' === $a['categoryId']) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ($b['categoryId'] === 'other') {
|
||||
if ('other' === $b['categoryId']) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue