Showing 151 of 1,190 total issues
Function mailUsage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function mailUsage(): JsonResponse
{
$size = 0;
foreach (ConfigService::getEmailConfigs() as $email) {
- 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 addToCategory
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addToCategory(Request $request, int $id, int $categoryId): JsonResponse
{
$orm = app(OrmService::class);
$page = $orm->getOne(Page::class, $id);
- 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 generateExtraNote
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function generateExtraNote(array $cart): string
{
$notes = [];
switch ($cart['payMethod'] ?? '') {
case 'creditcard':
- 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
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this method. Open
return sprintf(_('%s minutes and %s seconds ago'), $interval->i, $interval->s);
Avoid too many return
statements within this method. Open
return sprintf(_('%s hours and %s minutes ago'), $interval->h, $interval->i);
Avoid too many return
statements within this method. Open
return '';
Avoid too many return
statements within this method. Open
return sprintf(_('%s days and %s hours ago'), $interval->d, $interval->h);
Avoid too many return
statements within this method. Open
return "(
mime IN(
'application/pdf',
'application/msword',
'application/vnd.ms-%',
Avoid too many return
statements within this method. Open
return "mime = 'application/zip'";
Avoid too many return
statements within this method. Open
return _('The payment was received and the package is sent.');
Function handle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function handle(Request $request, callable $next): Response
{
$requestUrl = $request->getPathInfo();
if (0 !== mb_strpos($requestUrl, '/admin/') || '/admin/users/new/' === $requestUrl) {
return $next($request);
- 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 getOpenCategories
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getOpenCategories(array $openCategories, ?int $selectedId = null): array
{
if (null !== $selectedId) {
$category = app(OrmService::class)->getOne(Category::class, $selectedId);
if ($category) {
- 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 setShippingAddressVisability
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function setShippingAddressVisability(status) {
const rows = document.getElementsByTagName("tr");
for (const row of rows) {
if (row.className === "altpost") {
row.style.display = status ? "" : "none";
- 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 checkPageUrl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function checkPageUrl(Request $request, ?Category $category, ?Page $page): ?RedirectResponse
{
if (!$page || $page->isInactive()) {
if ($category && $category->getParent() && $category->isVisible()) {
$status = $page ? Response::HTTP_FOUND : Response::HTTP_MOVED_PERMANENTLY;
- 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 send
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function send(Request $request): Response
{
$rawCart = $request->get('cart');
if (!is_string($rawCart)) {
$rawCart = '';
- 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 isVisible
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function isVisible(): bool
{
if (self::HIDDEN === $this->renderMode) {
return false;
}
- 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 setColumnData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setColumnData(string $columnData): self
{
$columns = json_decode($columnData, true);
if (is_array($columns)) {
- 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 send
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function send(): void
{
if ($this->sent) {
throw new Exception(_('The newsletter has already been sent.'));
}
- 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 __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct()
{
$app = app();
$templatePath = $app->basePath('/theme');
$loader = new FilesystemLoader('default/', $templatePath);
- 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"