Showing 151 of 1,190 total issues
Method addressSave
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function addressSave(Request $request, int $id, string $checkId): Response
{
$invoice = app(OrmService::class)->getOne(Invoice::class, $id);
if ($redirect = $this->checkStatus($id, $checkId, $invoice)) {
return $redirect;
Method inventory
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function inventory(Request $request): Response
{
app(DbService::class)->addLoadedTable('bind', 'kat', 'krav', 'maerke', 'sider');
$response = $this->cachedResponse();
if ($response->isNotModified($request)) {
Function rss
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
public function rss(Request $request): Response
{
$db = app(DbService::class);
$db->addLoadedTable('bind', 'files', 'kat', 'maerke', 'sider');
- 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 __construct
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct(array $data = [])
{
$this->setItemData(strval($data['item_data'] ?? '[]'))
->setHasShippingAddress(boolval($data['has_shipping_address'] ?? false))
->setTimeStamp(intval($data['timestamp'] ?? time()))
Function updateOrientation
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function updateOrientation(move) {
orientation += orientation < 10 ? move : -move;
switch (orientation) {
case 1:
rotate = 0;
Method terms
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function terms(Request $request, int $id, string $checkId): Response
{
$invoice = app(OrmService::class)->getOne(Invoice::class, $id);
if ($redirect = $this->checkStatus($id, $checkId, $invoice)) {
return $redirect;
Method folderRename
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function folderRename(Request $request): JsonResponse
{
$path = $request->getRequestString('path') ?? '';
$name = $request->getRequestString('name') ?? '';
$name = $this->fileService->cleanFileName($name);
Method purifyHTML
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function purifyHTML(string $html): string
{
$config = HTMLPurifier_Config::createDefault();
/** @var Application */
$app = app();
Method index
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Function send
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function send() {
status("Klargøre data.");
totals = [];
uploads = [];
Method update
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function update(Request $request, int $id): JsonResponse
{
$user = $request->user();
if (!$user || (!$user->hasAccess(User::ADMINISTRATOR) && $user->getId() !== $id)) {
throw new InvalidInput(_('You do not have permission to edit users.'), Response::HTTP_FORBIDDEN);
Function listInsertRowCallback
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function listInsertRowCallback(data) {
if (!genericCallback(data)) {
return;
}
Method addToAddressBook
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function addToAddressBook(Invoice $invoice, ?string $clientIp): void
{
/** @var string[] */
$countries = Countries::getOrdered();
$conteact = app(OrmService::class)->getOneByQuery(
Function sendCart
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
"sendCart": function() {
const cart = shoppingCart.getCart();
cart.name = document.getElementById("name").value;
cart.attn = document.getElementById("attn").value;
cart.address = document.getElementById("address").value;
Method image
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function image(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);
Method mapFromDB
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function mapFromDB(array $data): array
{
$columnSortings = explode('<', $data['sorts']);
$columnSortings = array_map('intval', $columnSortings);
$columnTypes = explode('<', $data['cells']);
Method status
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function status(Request $request, int $id, string $checkId): Response
{
$invoice = app(OrmService::class)->getOne(Invoice::class, $id);
if (!$invoice || $checkId !== $invoice->getCheckId()) {
return redirect('/betaling/?id=' . $id . '&checkid=' . rawurlencode($checkId), Response::HTTP_SEE_OTHER);
Function siteMap
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function siteMap(Request $request): Response
{
app(DbService::class)->addLoadedTable('bind', 'kat', 'sider', 'special', 'maerke', 'krav');
$response = new Response('', Response::HTTP_OK, ['Content-Type' => 'text/xml;charset=utf-8']);
$response = $this->cachedResponse($response);
- 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 getRows
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getRows(?int $orderBy = null): array
{
$db = app(DbService::class);
$dataRows = $db->fetchArray(
Method getPages
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getPages(string $order = 'navn', bool $reverseOrder = false): array
{
app(DbService::class)->addLoadedTable('bind');
if (!in_array($order, ['navn', 'for', 'pris', 'varenr'], true)) {