Showing 51 of 66 total issues
Method runWithDbSort
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function runWithDbSort(int $page): MediaRepository
{
$params = [];
if ($this->isAdmin) {
[$queryMedia, $queryPages] = $this->buildAdminQueries();
Method getLdapRdn
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getLdapRdn(string $username, $server)
{
//Dynamic LDAP User Binding
if (@is_string($this->config['ldap']['search_filter'])) {
//Replace ???? with username
Method handlePartialRequest
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handlePartialRequest(
Response $response,
Stream $stream,
string $range,
string $disposition,
Function publishToggle
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
publishToggle: function () {
var id = $(this).data('id');
var $callerButton = $(this);
var isOutline = false;
if ($(this).data('published')) {
Method saveMedia
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function saveMedia(Response $response, UploadedFileInterface $file, $user, $code)
{
if ($code === null) {
do {
$code = humanRandomString();
Method mime2font
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mime2font($mime)
{
$classes = [
'image' => 'fa-file-image',
'audio' => 'fa-file-audio',
Method recoverMail
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function recoverMail(Request $request, Response $response): Response
{
if ($this->session->get('logged', false)) {
return redirect($response, route('home'));
}
Function saveTag
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
saveTag: function () {
var tag = $(this).val();
var mediaId = $(this).data('id');
var $parent = $(this).parent();
if (tag === '') {
Function login
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function login(Request $request, Response $response): Response
{
/** @var ValidationHelper $validator */
$validator = make(ValidationHelper::class);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getLdapRdn
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function getLdapRdn(string $username, $server)
{
//Dynamic LDAP User Binding
if (@is_string($this->config['ldap']['search_filter'])) {
//Replace ???? with username
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method createAppInstance
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function createAppInstance(Container $container)
{
$config = $container->get('config');
$loader = new FilesystemLoader(BASE_DIR.'resources/templates');
Method sendCreateNotification
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sendCreateNotification($request, $resetToken = null)
{
if ($resetToken === null && !empty(param($request, 'password'))) {
$message = lang('mail.new_account_text_with_pw', [
param($request, 'username'),
Method checkForUpdates
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function checkForUpdates(Request $request, Response $response): Response
{
$jsonResponse = [
'status' => 'OK',
'message' => lang('already_latest_version'),
Function addTag
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
addTag: function (e) {
var $caller = $(this);
var $newAddTag = $caller.clone()
.click(app.addTag)
.appendTo($caller.parent());
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(string $name, $path = '')
{
if (session_status() === PHP_SESSION_NONE) {
if (!is_writable($path) && $path !== '') {
throw new Exception("The given path '{$path}' is not writable.");
Method getString
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getString($key, $lang, $args): string
{
$redLang = strtolower(substr($lang, 0, 2));
if (array_key_exists($lang, $this->cache)) {
Method profileEdit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function profileEdit(Request $request, Response $response, int $id): Response
{
$user = make(UserRepository::class)->get($request, $id, true);
/** @var ValidationHelper $validator */
Method uploadEndpoint
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function uploadEndpoint(Request $request, Response $response): Response
{
if ($this->config['maintenance']) {
$this->json['message'] = 'Endpoint under maintenance.';
Consider simplifying this complex logical expression. Open
if (
UA::isBot($userAgent) &&
!(
// embed if enabled
(UA::embedsLinks($userAgent) &&
Function runWithDbSort
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function runWithDbSort(int $page): MediaRepository
{
$params = [];
if ($this->isAdmin) {
[$queryMedia, $queryPages] = $this->buildAdminQueries();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"