Showing 151 of 1,190 total issues
Function resize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function resize() {
$("save").style.display = "";
$("loading").style.visibility = "hidden";
if (resizeHandle !== null) {
resizeHandle.destroy();
Method findCategories
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function findCategories(string $searchString, string $antiWords): array
{
if (!$searchString) {
return [];
}
Method getPages
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPages(string $order = 'navn'): array
{
if (!in_array($order, ['navn', 'for', 'pris', 'varenr'], true)) {
$order = 'navn';
}
Function resize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function resize() {
$("save").style.display = "";
$("loading").style.visibility = "hidden";
if (resizeHandle !== null) {
resizeHandle.destroy();
- 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 mismatchedBindings
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function mismatchedBindings(): JsonResponse
{
$html = '';
// Map out active / inactive
- 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 fileRename
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function fileRename(Request $request, int $id): JsonResponse
{
try {
$file = app(OrmService::class)->getOne(File::class, $id);
if (!$file) {
- 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 index
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function index(Request $request, ?int $id = null): Response
{
$selectedId = intval($request->cookies->get('activekat', -1));
$openCategories = explode('<', strval($request->cookies->get('openkat', '')));
$openCategories = array_map('intval', $openCategories);
- 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 files
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function files(Request $request): JsonResponse
{
$path = $request->query->get('path');
if (!is_string($path)) {
$path = '';
Method address
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function address(Request $request): Response
{
$rawCart = $request->get('cart');
if (!is_string($rawCart)) {
$rawCart = '';
Method search
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search(Request $request): JsonResponse
{
$returnType = $request->query->get('return');
if (!is_string($returnType)) {
$returnType = '';
Method imageSaveThumb
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function imageSaveThumb(Request $request, int $id): Response
{
$file = app(OrmService::class)->getOne(File::class, $id);
if (!$file) {
throw new InvalidInput(_('File not found.'), Response::HTTP_NOT_FOUND);
Function addToEditor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
addToEditor() {
let data = "";
let html = "<a href=\"" + htmlEncode(this.path) + "\" target=\"_blank\">" + htmlEncode(this.name) + "</a>";
switch (this.type()) {
case "image":
Method badFolderNames
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function badFolderNames(): JsonResponse
{
$db = app(DbService::class);
$db->addLoadedTable('files');
Method redirectToSearch
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function redirectToSearch(Request $request): RedirectResponse
{
$redirectUrl = '/search/';
$query = preg_replace(
Method imageSave
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function imageSave(Request $request, int $id): Response
{
$file = app(OrmService::class)->getOne(File::class, $id);
if (!$file) {
throw new InvalidInput(_('File not found.'), Response::HTTP_NOT_FOUND);
Function cleanAddressData
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function cleanAddressData(array $data): array
{
$data = [
'name' => $data['name'] ?? '',
'attn' => $data['attn'] ?? '',
- 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 getShippingAddress
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getShippingAddress(array $countries): string
{
if (!$this->invoice->hasShippingAddress()) {
return '';
}
- 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 getRows
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getRows(?int $orderBy = null): array
{
$db = app(DbService::class);
$dataRows = $db->fetchArray(
- 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 checkSearchable
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function checkSearchable(Request $request): ?RedirectResponse
{
$brandId = $request->get('maerke');
if (!$request->get('q')
&& !$request->get('varenr')
- 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 files
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function files(Request $request): JsonResponse
{
$path = $request->query->get('path');
if (!is_string($path)) {
$path = '';
- 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"