mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Ran phpcbf and updated phpcs.xml
This commit is contained in:
parent
9a3e1490ff
commit
98a1e57ba9
@ -6,6 +6,7 @@ use BookStack\Auth\User;
|
|||||||
use BookStack\Entities\Models\Entity;
|
use BookStack\Entities\Models\Entity;
|
||||||
use BookStack\Model;
|
use BookStack\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,7 +24,7 @@ class Activity extends Model
|
|||||||
/**
|
/**
|
||||||
* Get the entity for this activity.
|
* Get the entity for this activity.
|
||||||
*/
|
*/
|
||||||
public function entity()
|
public function entity(): MorphTo
|
||||||
{
|
{
|
||||||
if ($this->entity_type === '') {
|
if ($this->entity_type === '') {
|
||||||
$this->entity_type = null;
|
$this->entity_type = null;
|
||||||
|
@ -48,4 +48,4 @@ class ActivityType
|
|||||||
const AUTH_PASSWORD_RESET_UPDATE = 'auth_password_reset_update';
|
const AUTH_PASSWORD_RESET_UPDATE = 'auth_password_reset_update';
|
||||||
const AUTH_LOGIN = 'auth_login';
|
const AUTH_LOGIN = 'auth_login';
|
||||||
const AUTH_REGISTER = 'auth_register';
|
const AUTH_REGISTER = 'auth_register';
|
||||||
}
|
}
|
||||||
|
@ -142,5 +142,4 @@ class ApiDocsGenerator
|
|||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
@ -163,4 +163,4 @@ class ApiTokenGuard implements Guard
|
|||||||
{
|
{
|
||||||
$this->user = null;
|
$this->user = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,5 +299,4 @@ class ExternalBaseSessionGuard implements StatefulGuard
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,13 +23,13 @@ class LdapSessionGuard extends ExternalBaseSessionGuard
|
|||||||
/**
|
/**
|
||||||
* LdapSessionGuard constructor.
|
* LdapSessionGuard constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct($name,
|
public function __construct(
|
||||||
|
$name,
|
||||||
UserProvider $provider,
|
UserProvider $provider,
|
||||||
Session $session,
|
Session $session,
|
||||||
LdapService $ldapService,
|
LdapService $ldapService,
|
||||||
RegistrationService $registrationService
|
RegistrationService $registrationService
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
$this->ldapService = $ldapService;
|
$this->ldapService = $ldapService;
|
||||||
parent::__construct($name, $provider, $session, $registrationService);
|
parent::__construct($name, $provider, $session, $registrationService);
|
||||||
}
|
}
|
||||||
@ -119,5 +119,4 @@ class LdapSessionGuard extends ExternalBaseSessionGuard
|
|||||||
|
|
||||||
return $this->registrationService->registerUser($details, null, false);
|
return $this->registrationService->registerUser($details, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,5 +34,4 @@ class Saml2SessionGuard extends ExternalBaseSessionGuard
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,6 @@ class RegistrationService
|
|||||||
$message = trans('auth.email_confirm_send_error');
|
$message = trans('auth.email_confirm_send_error');
|
||||||
throw new UserRegistrationException($message, '/register/confirm');
|
throw new UserRegistrationException($message, '/register/confirm');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $newUser;
|
return $newUser;
|
||||||
@ -109,5 +108,4 @@ class RegistrationService
|
|||||||
throw new UserRegistrationException(trans('auth.registration_email_domain_invalid'), $redirect);
|
throw new UserRegistrationException(trans('auth.registration_email_domain_invalid'), $redirect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
@ -13,4 +13,4 @@ class CustomStrikeThroughExtension implements ExtensionInterface
|
|||||||
$environment->addDelimiterProcessor(new StrikethroughDelimiterProcessor());
|
$environment->addDelimiterProcessor(new StrikethroughDelimiterProcessor());
|
||||||
$environment->addInlineRenderer(Strikethrough::class, new CustomStrikethroughRenderer());
|
$environment->addInlineRenderer(Strikethrough::class, new CustomStrikethroughRenderer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,4 +21,4 @@ class CustomStrikethroughRenderer implements InlineRendererInterface
|
|||||||
|
|
||||||
return new HtmlElement('s', $inline->getData('attributes', []), $htmlRenderer->renderInlines($inline->children()));
|
return new HtmlElement('s', $inline->getData('attributes', []), $htmlRenderer->renderInlines($inline->children()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,5 +137,4 @@ class SearchOptions
|
|||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace BookStack\Exceptions;
|
namespace BookStack\Exceptions;
|
||||||
|
|
||||||
class ApiAuthException extends UnauthorizedException {
|
class ApiAuthException extends UnauthorizedException
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,4 +22,4 @@ class JsonDebugException extends Exception
|
|||||||
{
|
{
|
||||||
return response()->json($this->data);
|
return response()->json($this->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,4 @@ class UnauthorizedException extends Exception
|
|||||||
{
|
{
|
||||||
parent::__construct($message, $code);
|
parent::__construct($message, $code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,4 +27,4 @@ abstract class ApiController extends Controller
|
|||||||
{
|
{
|
||||||
return $this->rules;
|
return $this->rules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,5 +25,4 @@ class ApiDocsController extends ApiController
|
|||||||
$docs = ApiDocsGenerator::generateConsideringCache();
|
$docs = ApiDocsGenerator::generateConsideringCache();
|
||||||
return response()->json($docs);
|
return response()->json($docs);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -91,4 +91,4 @@ class BookApiController extends ApiController
|
|||||||
$this->bookRepo->destroy($book);
|
$this->bookRepo->destroy($book);
|
||||||
return response('', 204);
|
return response('', 204);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,4 +112,4 @@ class BookshelfApiController extends ApiController
|
|||||||
$this->bookshelfRepo->destroy($shelf);
|
$this->bookshelfRepo->destroy($shelf);
|
||||||
return response('', 204);
|
return response('', 204);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,5 +195,4 @@ class LoginController extends Controller
|
|||||||
|
|
||||||
return redirect('/login');
|
return redirect('/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -117,5 +117,4 @@ class RegisterController extends Controller
|
|||||||
'password' => Hash::make($data['password']),
|
'password' => Hash::make($data['password']),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -82,5 +82,4 @@ class Saml2Controller extends Controller
|
|||||||
|
|
||||||
return redirect()->intended();
|
return redirect()->intended();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -140,5 +140,4 @@ class UserApiTokenController extends Controller
|
|||||||
$token = ApiToken::query()->where('user_id', '=', $user->id)->where('id', '=', $tokenId)->firstOrFail();
|
$token = ApiToken::query()->where('user_id', '=', $user->id)->where('id', '=', $tokenId)->firstOrFail();
|
||||||
return [$user, $token];
|
return [$user, $token];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,4 +33,4 @@ trait ChecksForEmailConfirmation
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,5 +14,4 @@ class ThrottleApiRequests extends Middleware
|
|||||||
{
|
{
|
||||||
return (int) config('api.requests_per_minute');
|
return (int) config('api.requests_per_minute');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
@ -8,4 +8,4 @@ interface Loggable
|
|||||||
* Get the string descriptor for this item.
|
* Get the string descriptor for this item.
|
||||||
*/
|
*/
|
||||||
public function logDescriptor(): string;
|
public function logDescriptor(): string;
|
||||||
}
|
}
|
||||||
|
@ -17,5 +17,4 @@ class TranslationServiceProvider extends BaseProvider
|
|||||||
return new FileLoader($app['files'], $app['path.lang']);
|
return new FileLoader($app['files'], $app['path.lang']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
@ -176,7 +176,7 @@ class SettingService
|
|||||||
*/
|
*/
|
||||||
protected function formatArrayValue(array $value): string
|
protected function formatArrayValue(array $value): string
|
||||||
{
|
{
|
||||||
$values = collect($value)->values()->filter(function(array $item) {
|
$values = collect($value)->values()->filter(function (array $item) {
|
||||||
return count(array_filter($item)) > 0;
|
return count(array_filter($item)) > 0;
|
||||||
});
|
});
|
||||||
return json_encode($values);
|
return json_encode($values);
|
||||||
|
@ -24,5 +24,4 @@ trait HasCreatorAndUpdater
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(User::class, 'updated_by');
|
return $this->belongsTo(User::class, 'updated_by');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,5 +15,4 @@ trait HasOwner
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(User::class, 'owned_by');
|
return $this->belongsTo(User::class, 'owned_by');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,4 +27,4 @@ class FileLoader extends BaseLoader
|
|||||||
|
|
||||||
return $this->loadNamespaced($locale, $group, $namespace);
|
return $this->loadNamespaced($locale, $group, $namespace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,8 +70,7 @@ class ImageRepo
|
|||||||
int $uploadedTo = null,
|
int $uploadedTo = null,
|
||||||
string $search = null,
|
string $search = null,
|
||||||
callable $whereClause = null
|
callable $whereClause = null
|
||||||
): array
|
): array {
|
||||||
{
|
|
||||||
$imageQuery = $this->image->newQuery()->where('type', '=', strtolower($type));
|
$imageQuery = $this->image->newQuery()->where('type', '=', strtolower($type));
|
||||||
|
|
||||||
if ($uploadedTo !== null) {
|
if ($uploadedTo !== null) {
|
||||||
@ -102,8 +101,7 @@ class ImageRepo
|
|||||||
int $pageSize = 24,
|
int $pageSize = 24,
|
||||||
int $uploadedTo = null,
|
int $uploadedTo = null,
|
||||||
string $search = null
|
string $search = null
|
||||||
): array
|
): array {
|
||||||
{
|
|
||||||
$contextPage = $this->page->findOrFail($uploadedTo);
|
$contextPage = $this->page->findOrFail($uploadedTo);
|
||||||
$parentFilter = null;
|
$parentFilter = null;
|
||||||
|
|
||||||
|
@ -97,5 +97,4 @@ class UserAvatars
|
|||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<ruleset name="PHP_CodeSniffer">
|
<ruleset name="BookStack Standard">
|
||||||
|
<!-- Format described at: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset -->
|
||||||
<description>The coding standard for BookStack.</description>
|
<description>The coding standard for BookStack.</description>
|
||||||
<file>app</file>
|
<config name="php_version" value="70205"/>
|
||||||
|
<file>./app</file>
|
||||||
<exclude-pattern>*/migrations/*</exclude-pattern>
|
<exclude-pattern>*/migrations/*</exclude-pattern>
|
||||||
<exclude-pattern>*/tests/*</exclude-pattern>
|
<exclude-pattern>*/tests/*</exclude-pattern>
|
||||||
<arg value="np"/>
|
<arg value="np"/>
|
||||||
|
<arg name="colors"/>
|
||||||
<rule ref="PSR2"/>
|
<rule ref="PSR2"/>
|
||||||
</ruleset>
|
</ruleset>
|
Loading…
Reference in New Issue
Block a user