Showing 51 of 66 total issues
File MediaController.php
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Controllers;
use App\Database\Repositories\UserRepository;
Function migrate
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function migrate(): void
{
$this->db->getPdo()->exec(file_get_contents($this->schemaPath.DIRECTORY_SEPARATOR.'migrations.sql'));
$files = glob($this->schemaPath.'/'.$this->db->getCurrentDriver().'/*.sql');
- 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 runWithFileSort
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function runWithFileSort(int $page): MediaRepository
{
$this->storage->addPlugin(new ListWith());
if ($this->isAdmin) {
- 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 runWithFileSort
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function runWithFileSort(int $page): MediaRepository
{
$this->storage->addPlugin(new ListWith());
if ($this->isAdmin) {
File app.js
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
var app = {
init: function () {
Dropzone.options.uploadDropzone = {
paramName: 'upload',
maxFilesize: window.AppConfig.max_upload_size / Math.pow(1024, 2), // MB
File MediaRepository.php
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Database\Repositories;
use App\Database\DB;
Function ldapLogin
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function ldapLogin(Request $request, string $username, string $password, $dbUser)
{
// Build LDAP connection
$server = $this->ldapConnect();
if (!$server) {
- 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 show
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show(
Request $request,
Response $response,
string $userCode,
string $mediaCode,
Method ldapLogin
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function ldapLogin(Request $request, string $username, string $password, $dbUser)
{
// Build LDAP connection
$server = $this->ldapConnect();
if (!$server) {
Method update
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update(Request $request, Response $response, int $id): Response
{
$user = make(UserRepository::class)->get($request, $id);
$user->max_disk_quota = -1;
Method store
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function store(Request $request, Response $response): Response
{
$maxUserQuota = -1;
$validator = $this->getUserCreateValidator($request)
->callIf($this->getSetting('quota_enabled') === 'on', function ($session) use (&$maxUserQuota, &$request) {
Function upgrade
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function upgrade(Response $response, Logger $logger, Session $session): Response
{
if (!extension_loaded('zip')) {
$session->alert(lang('zip_ext_not_loaded'), 'danger');
return redirect($response, route('system'));
- 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 getString
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function getString($key, $lang, $args): string
{
$redLang = strtolower(substr($lang, 0, 2));
if (array_key_exists($lang, $this->cache)) {
- 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 show
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function show(
Request $request,
Response $response,
string $userCode,
string $mediaCode,
- 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 register
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(Request $request, Response $response): Response
{
if ($this->session->get('logged', false)) {
return redirect($response, route('home'));
}
Method migrate
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function migrate(): void
{
$this->db->getPdo()->exec(file_get_contents($this->schemaPath.DIRECTORY_SEPARATOR.'migrations.sql'));
$files = glob($this->schemaPath.'/'.$this->db->getCurrentDriver().'/*.sql');
Method login
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function login(Request $request, Response $response): Response
{
/** @var ValidationHelper $validator */
$validator = make(ValidationHelper::class);
Method home
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function home(Request $request, Response $response, int $page = 0): Response
{
$page = max(0, --$page);
switch (param($request, 'sort', 'time')) {
Method streamMedia
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function streamMedia(
Request $request,
Response $response,
Filesystem $storage,
$media,
Method ldapConnect
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function ldapConnect()
{
if (!extension_loaded('ldap')) {
$this->logger->error('The LDAP extension is not loaded.');
return false;