Showing 226 of 573 total issues
Method getMonthlyStats
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getMonthlyStats(): array
{
$conn = $this->getEntityManager()
->getConnection();
Method blurhash
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function blurhash(string $filePath): ?string
{
try {
$image = imagecreatefromstring(file_get_contents($filePath));
$width = imagesx($image);
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
string $title,
?string $url,
?string $body,
Magazine $magazine,
User $user,
Method findBoosts
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function findBoosts(int $page, User $user): PagerfantaInterface
{
// @todo union adapter
$conn = $this->entityManager->getConnection();
$sql = "
Method front
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function front(?string $sortBy, ?string $time, PostRepository $repository, Request $request): Response
{
$user = $this->getUser();
$criteria = new PostPageView($this->getPageNb($request));
Function addCommentOverview
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async addCommentOverview(data) {
try {
const parent = document.getElementById(data.detail.parentSubject.htmlId);
if (!parent) {
return;
Method search
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function search($query, int $page = 1): PagerfantaInterface
{
// @todo union adapter
$conn = $this->entityManager->getConnection();
$sql = "
Method getFunctions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getFunctions(): array
{
return [
new TwigFunction('entry_url', [UrlExtensionRuntime::class, 'entryUrl']),
new TwigFunction('entry_edit_url', [UrlExtensionRuntime::class, 'entryEditUrl']),
Function sendForm
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
async sendForm(event) {
event.preventDefault();
const form = event.target.closest('form');
const url = form.action;
- 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 handleEntries
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
async handleEntries(url) {
let response = await fetch(url, {method: 'GET'});
response = await ok(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 buildResult
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function buildResult(array $result, $page, $countAll)
{
$entries = $this->entityManager->getRepository(Entry::class)->findBy(
['id' => $this->getOverviewIds((array) $result, 'entry')]
);
Method updateMagazine
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function updateMagazine(string $actorUrl): Magazine
{
$magazine = $this->magazineRepository->findOneBy(['apProfileId' => $actorUrl]);
$actor = $this->apHttpClient->getActorObject($actorUrl);
Method getStats
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getStats(
?Magazine $magazine,
string $intervalStr,
?\DateTime $start,
?\DateTime $end,
Method create
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function create(
int $id = null,
MagazineSmallResponseDto $magazine = null,
UserSmallResponseDto $user = null,
DomainDto $domain = null,
Method getTests
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getTests(): array
{
return [
new TwigTest(
'entry', function ($subject) {
Method byMagazine
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
#[OA\Response(
response: 200,
description: 'A paginated list of posts from the magazine',
content: new OA\JsonContent(
type: 'object',
Method __invoke
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
#[IsGranted('ROLE_USER')]
#[IsGranted('moderate', subject: 'comment')]
public function __invoke(
#[MapEntity(mapping: ['magazine_name' => 'name'])]
Magazine $magazine,
Method getDailyStats
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getDailyStats(): array
{
$conn = $this->getEntityManager()
->getConnection();
Method __invoke
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
#[IsGranted('moderate', subject: 'comment')]
public function __invoke(
#[MapEntity(mapping: ['magazine_name' => 'name'])]
Magazine $magazine,
#[MapEntity(id: 'entry_id')]
Method findOrCreateFromPath
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function findOrCreateFromPath(string $source): ?Image
{
$fileName = $this->imageManager->getFileName($source);
$filePath = $this->imageManager->getFilePath($source);
$sha256 = hash_file('sha256', $source, true);