Skip to content

Commit

Permalink
Merge branch 'release/v0.0.5' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
octfx committed Sep 2, 2020
2 parents 9059f84 + ab69e94 commit 104000c
Show file tree
Hide file tree
Showing 80 changed files with 6,691 additions and 4,014 deletions.
4 changes: 2 additions & 2 deletions app/Console/Commands/CommLink/Download/DownloadCommLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public function handle(): int
$ids = collect($this->argument('id'));

$ids = $ids->filter(
function ($id) {
static function ($id) {
return is_numeric($id);
}
)->filter(
function ($id) {
static function ($id) {
return (int) $id >= 12663;
}
);
Expand Down
25 changes: 9 additions & 16 deletions app/Contracts/Web/User/AuthRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
<?php

declare(strict_types=1);
/**
* Created by PhpStorm.
* User: Hanne
* Date: 09.08.2018
* Time: 10:51.
*/
<?php declare(strict_types=1);

namespace App\Contracts\Web\User;

use App\Models\Account\User\User;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

/**
* Interface AuthRepositoryInterface.
Expand All @@ -21,7 +14,7 @@ interface AuthRepositoryInterface
/**
* Starts the Auth process and redirects to the provider.
*
* @return \Illuminate\Http\Response | Illuminate\View\View
* @return Response
*/
public function startAuth();

Expand All @@ -30,25 +23,25 @@ public function startAuth();
*
* @param Request $request
*
* @return \App\Models\Account\User\User
* @return User
*/
public function getUserFromProvider(Request $request): User;

/**
* Returns the associated local user. Creates a new Record if no user has been found for the given provider.
*
* @param \App\Models\Account\User\User $oauthUser
* @param string $provider
* @param User $oauthUser
* @param string $provider
*
* @return \App\Models\Account\User\User
* @return User
*/
public function getOrCreateLocalUser(User $oauthUser, string $provider): User;

/**
* Syncs the given wiki groups to the local record.
*
* @param \App\Models\Account\User\User $oauthUser
* @param \App\Models\Account\User\User $user
* @param User $oauthUser
* @param User $user
*/
public function syncLocalUserGroups(User $oauthUser, User $user): void;
}
4 changes: 2 additions & 2 deletions app/Events/ModelUpdating.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class ModelUpdating
{
use Dispatchable, InteractsWithSockets, SerializesModels;

public $model;
public Model $model;

/**
* Create a new event instance.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param Model $model
*/
public function __construct(Model $model)
{
Expand Down
5 changes: 0 additions & 5 deletions app/Exceptions/InvalidDataException.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php declare(strict_types = 1);
/**
* User: Hannes
* Date: 29.01.2017
* Time: 13:20
*/

namespace App\Exceptions;

Expand Down
48 changes: 23 additions & 25 deletions app/Http/Controllers/Api/AbstractApiController.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<?php declare(strict_types = 1);
/**
* User: Hannes
* Date: 26.07.2018
* Time: 12:52
*/

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Transformers\Api\LocaleAwareTransformerInterface;
use Carbon\Carbon;
use Dingo\Api\Http\Response;
use Dingo\Api\Routing\Helpers;
use Dingo\Api\Transformer\Factory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use League\Fractal\TransformerAbstract;

/**
* Base Controller that has Dingo Helpers
Expand Down Expand Up @@ -45,39 +43,39 @@ abstract class AbstractApiController extends Controller
private const LOCALE = 'locale';

/**
* @var \Illuminate\Http\Request The API Request
* @var Request The API Request
*/
protected $request;
protected Request $request;

/**
* @var \League\Fractal\TransformerAbstract The Default Transformer for index and show
* @var TransformerAbstract The Default Transformer for index and show
*/
protected $transformer;
protected TransformerAbstract $transformer;

/**
* @var array Parameter Errors
*/
protected $errors = [];
protected array $errors = [];

/**
* @var int Pagination Limit, 0 = no pagination
* @var ?int Pagination Limit, 0 = no pagination
*/
protected $limit;

/**
* @var string Locale Code, set if Transformer implements LocaleAwareTransformerInterface
*/
protected $localeCode;
protected string $localeCode;

/**
* @var array Extra Metadata to include
*/
protected $extraMeta = [];
protected array $extraMeta = [];

/**
* AbstractApiController constructor.
*
* @param \Illuminate\Http\Request $request API Request
* @param Request $request API Request
*/
public function __construct(Request $request)
{
Expand All @@ -100,11 +98,11 @@ protected function processRequestParams()
* Creates the API Response, Collection if no pagination, Paginator if a limit is set
* Item if a single model is given
*
* @param \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model $query
* @param Builder|Model $query
*
* @return \Dingo\Api\Http\Response
* @return Response
*/
protected function getResponse($query)
protected function getResponse($query): Response
{
if ($query instanceof Model) {
return $this->response->item($query, $this->transformer)->setMeta($this->getMeta());
Expand Down Expand Up @@ -148,7 +146,7 @@ protected function getMeta(): array
*/
protected function setLocale(string $localeCode)
{
if (in_array($localeCode, config('language.codes'))) {
if (in_array($localeCode, config('language.codes'), true)) {
$this->localeCode = $localeCode;
if ($this->transformer instanceof LocaleAwareTransformerInterface) {
$this->transformer->setLocale($localeCode);
Expand All @@ -163,7 +161,7 @@ protected function setLocale(string $localeCode)
*
* @param string|array $relations
*/
protected function checkIncludes($relations)
protected function checkIncludes($relations): void
{
if (!is_array($relations)) {
$relations = explode(',', $relations);
Expand All @@ -172,16 +170,16 @@ protected function checkIncludes($relations)
$relations = collect($relations);

$relations->transform(
function ($relation) {
static function ($relation) {
return trim($relation);
}
)->transform(
function ($relation) {
static function ($relation) {
return Str::camel($relation);
}
)->each(
function ($relation) {
if (!in_array($relation, $this->transformer->getAvailableIncludes())) {
if (!in_array($relation, $this->transformer->getAvailableIncludes(), true)) {
$this->errors['include'][] = sprintf(static::INVALID_RELATION_STRING, Str::snake($relation));
}
}
Expand All @@ -191,7 +189,7 @@ function ($relation) {
/**
* Processes the 'limit' Request-Parameter
*/
private function processLimit()
private function processLimit(): void
{
if ($this->request->has(self::LIMIT) && null !== $this->request->get(self::LIMIT, null)) {
$itemLimit = (int) $this->request->get(self::LIMIT);
Expand All @@ -209,7 +207,7 @@ private function processLimit()
/**
* Processes the 'include' Model Relations Request-Parameter
*/
private function processIncludes()
private function processIncludes(): void
{
if ($this->request->has('include') && null !== $this->request->get('include', null)) {
$this->checkIncludes($this->request->get('include', []));
Expand All @@ -219,7 +217,7 @@ private function processIncludes()
/**
* Processes the 'locale' Request-Parameter
*/
private function processLocale()
private function processLocale(): void
{
if ($this->request->has(self::LOCALE) && null !== $this->request->get(self::LOCALE, null)) {
$this->setLocale($this->request->get(self::LOCALE));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
<?php declare(strict_types = 1);
/**
* User: Hannes
* Date: 27.09.2018
* Time: 10:29
*/

namespace App\Http\Controllers\Api\V1\Rsi\CommLink\Category;

use App\Http\Controllers\Api\AbstractApiController as ApiController;
use App\Models\Rsi\CommLink\Category\Category;
use App\Transformers\Api\V1\Rsi\CommLink\Category\CategoryTransformer;
use App\Transformers\Api\V1\Rsi\CommLink\CommLinkTransformer;
use Dingo\Api\Http\Response;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request;
use League\Fractal\TransformerAbstract;

/**
* Class Category Controller
Expand All @@ -22,15 +19,15 @@ class CategoryController extends ApiController
/**
* Comm-Link Transformer
*
* @var \App\Transformers\Api\V1\Rsi\CommLink\Category\CategoryTransformer
* @var CategoryTransformer
*/
protected $transformer;
protected TransformerAbstract $transformer;

/**
* StatsAPIController constructor.
*
* @param \Illuminate\Http\Request $request
* @param \App\Transformers\Api\V1\Rsi\CommLink\Category\CategoryTransformer $transformer
* @param Request $request
* @param CategoryTransformer $transformer
*/
public function __construct(Request $request, CategoryTransformer $transformer)
{
Expand All @@ -41,9 +38,9 @@ public function __construct(Request $request, CategoryTransformer $transformer)
/**
* Ausgabe aller Comm-Links
*
* @return \Dingo\Api\Http\Response
* @return Response
*/
public function index()
public function index(): Response
{
$categories = Category::query()->orderBy('name');

Expand All @@ -53,9 +50,9 @@ public function index()
/**
* @param string $category
*
* @return \Dingo\Api\Http\Response
* @return Response
*/
public function show(string $category)
public function show(string $category): Response
{
try {
$category = Category::query()->where('name', $category)->orWhere('slug', $category)->firstOrFail();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
<?php declare(strict_types = 1);
/**
* User: Hannes
* Date: 27.09.2018
* Time: 10:29
*/

namespace App\Http\Controllers\Api\V1\Rsi\CommLink\Channel;

use App\Http\Controllers\Api\AbstractApiController as ApiController;
use App\Models\Rsi\CommLink\Channel\Channel;
use App\Transformers\Api\V1\Rsi\CommLink\Channel\ChannelTransformer;
use App\Transformers\Api\V1\Rsi\CommLink\CommLinkTransformer;
use Dingo\Api\Http\Response;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request;
use League\Fractal\TransformerAbstract;

/**
* Class Channel Controller
Expand All @@ -22,15 +19,15 @@ class ChannelController extends ApiController
/**
* Comm-Link Transformer
*
* @var \App\Transformers\Api\V1\Rsi\CommLink\Channel\ChannelTransformer
* @var ChannelTransformer
*/
protected $transformer;
protected TransformerAbstract $transformer;

/**
* StatsAPIController constructor.
*
* @param \Illuminate\Http\Request $request
* @param \App\Transformers\Api\V1\Rsi\CommLink\Channel\ChannelTransformer $transformer
* @param Request $request
* @param ChannelTransformer $transformer
*/
public function __construct(Request $request, ChannelTransformer $transformer)
{
Expand All @@ -41,9 +38,9 @@ public function __construct(Request $request, ChannelTransformer $transformer)
/**
* Ausgabe aller Channel
*
* @return \Dingo\Api\Http\Response
* @return Response
*/
public function index()
public function index(): Response
{
$categories = Channel::query()->orderBy('name');

Expand All @@ -53,7 +50,7 @@ public function index()
/**
* @param string $channel
*
* @return \Dingo\Api\Http\Response
* @return Response
*/
public function show(string $channel)
{
Expand Down
Loading

0 comments on commit 104000c

Please sign in to comment.