diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2019-11-06 13:43:57 +0100 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2019-11-06 13:43:57 +0100 |
commit | 8b5b9e2c65193171a12bf99a8df860a66e6900a5 (patch) | |
tree | eed7c815dfa7f6b034dff3e758e6578d26e3d81e /src | |
parent | 2cce967eb09edd6ef35238c68f8ff5ed2348f5fd (diff) |
src/: Formatting, doc block hints and cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/Controllers/Metrics/Stats.php | 5 | ||||
-rw-r--r-- | src/Controllers/PasswordResetController.php | 2 | ||||
-rw-r--r-- | src/Middleware/LegacyMiddleware.php | 2 | ||||
-rw-r--r-- | src/Models/EventConfig.php | 17 | ||||
-rw-r--r-- | src/Models/LogEntry.php | 18 | ||||
-rw-r--r-- | src/Models/User/Contact.php | 8 | ||||
-rw-r--r-- | src/Models/User/PasswordReset.php | 11 | ||||
-rw-r--r-- | src/Models/User/PersonalData.php | 23 | ||||
-rw-r--r-- | src/Models/User/Settings.php | 10 | ||||
-rw-r--r-- | src/Models/User/State.php | 27 | ||||
-rw-r--r-- | src/Models/User/User.php | 42 | ||||
-rw-r--r-- | src/Models/User/UsesUserModel.php | 7 | ||||
-rw-r--r-- | src/helpers.php | 18 |
13 files changed, 107 insertions, 83 deletions
diff --git a/src/Controllers/Metrics/Stats.php b/src/Controllers/Metrics/Stats.php index 7098d94f..af453cde 100644 --- a/src/Controllers/Metrics/Stats.php +++ b/src/Controllers/Metrics/Stats.php @@ -43,6 +43,7 @@ class Stats ->distinct(); $query->where(function ($query) use ($working) { + /** @var QueryBuilder $query */ if ($working) { $query ->whereNotNull('ShiftEntry.SID') @@ -271,7 +272,7 @@ class Stats { $start = microtime(true); - EventConfig::findOrNew('last_metrics'); + (new EventConfig())->findOrNew('last_metrics'); return microtime(true) - $start; } @@ -281,7 +282,7 @@ class Stats */ public function databaseWrite() { - $config = EventConfig::findOrNew('last_metrics'); + $config = (new EventConfig())->findOrNew('last_metrics'); $config ->setAttribute('name', 'last_metrics') ->setAttribute('value', new Carbon()); diff --git a/src/Controllers/PasswordResetController.php b/src/Controllers/PasswordResetController.php index 505ed8eb..a1460104 100644 --- a/src/Controllers/PasswordResetController.php +++ b/src/Controllers/PasswordResetController.php @@ -74,7 +74,7 @@ class PasswordResetController extends BaseController /** @var User $user */ $user = User::whereEmail($data['email'])->first(); if ($user) { - $reset = PasswordReset::findOrNew($user->id); + $reset = (new PasswordReset)->findOrNew($user->id); $reset->user_id = $user->id; $reset->token = md5(random_bytes(64)); $reset->save(); diff --git a/src/Middleware/LegacyMiddleware.php b/src/Middleware/LegacyMiddleware.php index e26b0851..478ffab1 100644 --- a/src/Middleware/LegacyMiddleware.php +++ b/src/Middleware/LegacyMiddleware.php @@ -219,6 +219,8 @@ class LegacyMiddleware implements MiddlewareInterface } redirect(page_link_to('login')); + + return []; } /** diff --git a/src/Models/EventConfig.php b/src/Models/EventConfig.php index 2dc6a3d8..b56e4c72 100644 --- a/src/Models/EventConfig.php +++ b/src/Models/EventConfig.php @@ -3,17 +3,18 @@ namespace Engelsystem\Models; use Carbon\Carbon; +use Illuminate\Database\Query\Builder as QueryBuilder; /** - * @property string $name - * @property string $value - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at + * @property string $name + * @property string $value + * @property Carbon $created_at + * @property Carbon $updated_at * - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\EventConfig[] whereName($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\EventConfig[] whereValue($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\EventConfig[] whereCreatedAt($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\EventConfig[] whereUpdatedAt($value) + * @method static QueryBuilder|EventConfig[] whereName($value) + * @method static QueryBuilder|EventConfig[] whereValue($value) + * @method static QueryBuilder|EventConfig[] whereCreatedAt($value) + * @method static QueryBuilder|EventConfig[] whereUpdatedAt($value) */ class EventConfig extends BaseModel { diff --git a/src/Models/LogEntry.php b/src/Models/LogEntry.php index db427eb9..53f72b65 100644 --- a/src/Models/LogEntry.php +++ b/src/Models/LogEntry.php @@ -2,19 +2,21 @@ namespace Engelsystem\Models; +use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Query\Builder as QueryBuilder; /** - * @property int $id - * @property string $level - * @property string $message - * @property \Carbon\Carbon|null $created_at + * @property int $id + * @property string $level + * @property string $message + * @property Carbon|null $created_at * - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\LogEntry[] whereId($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\LogEntry[] whereLevel($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\LogEntry[] whereMessage($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\LogEntry[] whereCreatedAt($value) + * @method static QueryBuilder|LogEntry[] whereId($value) + * @method static QueryBuilder|LogEntry[] whereLevel($value) + * @method static QueryBuilder|LogEntry[] whereMessage($value) + * @method static QueryBuilder|LogEntry[] whereCreatedAt($value) */ class LogEntry extends BaseModel { diff --git a/src/Models/User/Contact.php b/src/Models/User/Contact.php index 9b4bdb2b..8077350b 100644 --- a/src/Models/User/Contact.php +++ b/src/Models/User/Contact.php @@ -2,14 +2,16 @@ namespace Engelsystem\Models\User; +use Illuminate\Database\Query\Builder as QueryBuilder; + /** * @property string|null $dect * @property string|null $email * @property string|null $mobile * - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Contact[] whereDect($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Contact[] whereEmail($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Contact[] whereMobile($value) + * @method static QueryBuilder|Contact[] whereDect($value) + * @method static QueryBuilder|Contact[] whereEmail($value) + * @method static QueryBuilder|Contact[] whereMobile($value) */ class Contact extends HasUserModel { diff --git a/src/Models/User/PasswordReset.php b/src/Models/User/PasswordReset.php index 5cf66953..82f44add 100644 --- a/src/Models/User/PasswordReset.php +++ b/src/Models/User/PasswordReset.php @@ -2,12 +2,15 @@ namespace Engelsystem\Models\User; +use Carbon\Carbon; +use Illuminate\Database\Query\Builder as QueryBuilder; + /** - * @property string $token - * @property \Carbon\Carbon|null $created_at + * @property string $token + * @property Carbon|null $created_at * - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PasswordReset[] whereToken($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PasswordReset[] whereCreatedAt($value) + * @method static QueryBuilder|PasswordReset[] whereToken($value) + * @method static QueryBuilder|PasswordReset[] whereCreatedAt($value) */ class PasswordReset extends HasUserModel { diff --git a/src/Models/User/PersonalData.php b/src/Models/User/PersonalData.php index 921e821e..228f55f3 100644 --- a/src/Models/User/PersonalData.php +++ b/src/Models/User/PersonalData.php @@ -2,18 +2,21 @@ namespace Engelsystem\Models\User; +use Carbon\Carbon; +use Illuminate\Database\Query\Builder as QueryBuilder; + /** - * @property string|null $first_name - * @property string|null $last_name - * @property string|null $shirt_size - * @property \Carbon\Carbon|null $planned_arrival_date - * @property \Carbon\Carbon|null $planned_departure_date + * @property string|null $first_name + * @property string|null $last_name + * @property string|null $shirt_size + * @property Carbon|null $planned_arrival_date + * @property Carbon|null $planned_departure_date * - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData[] whereFirstName($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData[] whereLastName($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData[] whereShirtSize($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData[] wherePlannedArrivalDate($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData[] wherePlannedDepartureDate($value) + * @method static QueryBuilder|PersonalData[] whereFirstName($value) + * @method static QueryBuilder|PersonalData[] whereLastName($value) + * @method static QueryBuilder|PersonalData[] whereShirtSize($value) + * @method static QueryBuilder|PersonalData[] wherePlannedArrivalDate($value) + * @method static QueryBuilder|PersonalData[] wherePlannedDepartureDate($value) */ class PersonalData extends HasUserModel { diff --git a/src/Models/User/Settings.php b/src/Models/User/Settings.php index d062f902..244f06e6 100644 --- a/src/Models/User/Settings.php +++ b/src/Models/User/Settings.php @@ -2,16 +2,18 @@ namespace Engelsystem\Models\User; +use Illuminate\Database\Query\Builder as QueryBuilder; + /** * @property string $language * @property int $theme * @property bool $email_human * @property bool $email_shiftinfo * - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings[] whereLanguage($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings[] whereTheme($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings[] whereEmailHuman($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings[] whereEmailShiftinfo($value) + * @method static QueryBuilder|Settings[] whereLanguage($value) + * @method static QueryBuilder|Settings[] whereTheme($value) + * @method static QueryBuilder|Settings[] whereEmailHuman($value) + * @method static QueryBuilder|Settings[] whereEmailShiftinfo($value) */ class Settings extends HasUserModel { diff --git a/src/Models/User/State.php b/src/Models/User/State.php index fbb8ad20..46660b7c 100644 --- a/src/Models/User/State.php +++ b/src/Models/User/State.php @@ -2,20 +2,23 @@ namespace Engelsystem\Models\User; +use Carbon\Carbon; +use Illuminate\Database\Query\Builder as QueryBuilder; + /** - * @property bool $arrived - * @property \Carbon\Carbon|null $arrival_date - * @property bool $active - * @property bool $force_active - * @property bool $got_shirt - * @property int $got_voucher + * @property bool $arrived + * @property Carbon|null $arrival_date + * @property bool $active + * @property bool $force_active + * @property bool $got_shirt + * @property int $got_voucher * - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State[] whereArrived($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State[] whereArrivalDate($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State[] whereActive($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State[] whereForceActive($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State[] whereGotShirt($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State[] whereGotVoucher($value) + * @method static QueryBuilder|State[] whereArrived($value) + * @method static QueryBuilder|State[] whereArrivalDate($value) + * @method static QueryBuilder|State[] whereActive($value) + * @method static QueryBuilder|State[] whereForceActive($value) + * @method static QueryBuilder|State[] whereGotShirt($value) + * @method static QueryBuilder|State[] whereGotVoucher($value) */ class State extends HasUserModel { diff --git a/src/Models/User/User.php b/src/Models/User/User.php index 4be3246c..af213c4e 100644 --- a/src/Models/User/User.php +++ b/src/Models/User/User.php @@ -2,32 +2,34 @@ namespace Engelsystem\Models\User; +use Carbon\Carbon; use Engelsystem\Models\BaseModel; use Illuminate\Database\Eloquent\Relations\HasOne; +use Illuminate\Database\Query\Builder as QueryBuilder; /** - * @property integer $id - * @property string $name - * @property string $email - * @property string $password - * @property string $api_key - * @property \Carbon\Carbon|null $last_login_at - * @property \Carbon\Carbon $created_at - * @property \Carbon\Carbon $updated_at + * @property integer $id + * @property string $name + * @property string $email + * @property string $password + * @property string $api_key + * @property Carbon|null $last_login_at + * @property Carbon $created_at + * @property Carbon $updated_at * - * @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Contact $contact - * @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\PersonalData $personalData - * @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\Settings $settings - * @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\State $state + * @property-read QueryBuilder|Contact $contact + * @property-read QueryBuilder|PersonalData $personalData + * @property-read QueryBuilder|Settings $settings + * @property-read QueryBuilder|State $state * - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User whereId($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] whereName($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] whereEmail($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] wherePassword($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] whereApiKey($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] whereLastLoginAt($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] whereCreatedAt($value) - * @method static \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User[] whereUpdatedAt($value) + * @method static QueryBuilder|User whereId($value) + * @method static QueryBuilder|User[] whereName($value) + * @method static QueryBuilder|User[] whereEmail($value) + * @method static QueryBuilder|User[] wherePassword($value) + * @method static QueryBuilder|User[] whereApiKey($value) + * @method static QueryBuilder|User[] whereLastLoginAt($value) + * @method static QueryBuilder|User[] whereCreatedAt($value) + * @method static QueryBuilder|User[] whereUpdatedAt($value) */ class User extends BaseModel { diff --git a/src/Models/User/UsesUserModel.php b/src/Models/User/UsesUserModel.php index 84795480..e0185b10 100644 --- a/src/Models/User/UsesUserModel.php +++ b/src/Models/User/UsesUserModel.php @@ -3,13 +3,14 @@ namespace Engelsystem\Models\User; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Query\Builder as QueryBuilder; /** - * @property integer $user_id + * @property integer $user_id * - * @property-read \Illuminate\Database\Query\Builder|\Engelsystem\Models\User\User $user + * @property-read QueryBuilder|User $user * - * @method static \Illuminate\Database\Query\Builder|static whereUserId($value) + * @method static QueryBuilder|static whereUserId($value) */ trait UsesUserModel { diff --git a/src/helpers.php b/src/helpers.php index 051b78a3..796b8764 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -52,6 +52,7 @@ function base_path($path = '') */ function config($key = null, $default = null) { + /** @var Config $config */ $config = app('config'); if (empty($key)) { @@ -119,6 +120,7 @@ function response($content = '', $status = 200, $headers = []) */ function session($key = null, $default = null) { + /** @var SessionInterface $session */ $session = app('session'); if (is_null($key)) { @@ -131,8 +133,8 @@ function session($key = null, $default = null) /** * Translate the given message * - * @param string $key - * @param array $replace + * @param string $key + * @param array $replace * @return string|Translator */ function trans($key = null, $replace = []) @@ -150,8 +152,8 @@ function trans($key = null, $replace = []) /** * Translate the given message * - * @param string $key - * @param array $replace + * @param string $key + * @param array $replace * @return string */ function __($key, $replace = []) @@ -165,10 +167,10 @@ function __($key, $replace = []) /** * Translate the given message * - * @param string $key - * @param string $keyPlural - * @param int $number - * @param array $replace + * @param string $key + * @param string $keyPlural + * @param int $number + * @param array $replace * @return string */ function _e($key, $keyPlural, $number, $replace = []) |