Showing 15 of 33 total issues
Method search
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search(Request $request, $categoryId = "", $slug = "")
{
$category = null;
if ($categoryId !== "") {
$category = $this->categoryRepository->find($categoryId);
Method showTricksByTag
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function showTricksByTag(Request $request, Tag $tag, string $slug)
{
if ($tag->getSlug() !== $slug) {
return $this->correctSlug($tag);
}
Function setPrimaryImage
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setPrimaryImage(image) {
let primaryImageLoader = document.querySelector('#primary-image-preloader');
let primaryImage = document.querySelector('#trick-primary-image');
Function addEditForm
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Window.prototype.addEditForm = function(e, linkElement){
e.preventDefault();
let commentId = linkElement.dataset.commentid;
let url = linkElement.href;
Method searchTricks
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function searchTricks(string $query)
{
$query = $this->sanitizeSearchQuery($query);
$searchTerms = $this->extractSearchTerms($query);
Method edit
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(Trick $trick, Request $request)
{
$originalTrickImages = $trick->getImages()->count();
/** @var Form $form */
$form = $this->createForm(TrickFormType::class, $trick, [
Method buildForm
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event){
$video = $event->getData();
Method getSubscribedEvents
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getSubscribedEvents()
{
return [
UserRegisteredEvent::NAME => [
['setPassword', 50],
Method buildForm
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('plainPassword', RepeatedType::class, [
'type' => PasswordType::class,
Method show
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show(Trick $trick, string $slug, Request $request)
{
//Checking if slug is equal to the ID. This is for SEO and external links
if ($trick->getSlug() !== $slug) {
return $this->correctSlug($trick);
Function searchTricks
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function searchTricks(string $query)
{
$query = $this->sanitizeSearchQuery($query);
$searchTerms = $this->extractSearchTerms($query);
- 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 send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function send(string $subject, string $template, $mailData, string $to, String $from = null): bool
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
TrickRepository $trickRepository,
CategoryRepository $categoryRepository,
TagRepository $tagRepository,
ImageRepository $imageRepository,
VideoRepository $videoRepository
Function setPrimaryImageToggle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function setPrimaryImageToggle(ImageSetPrimaryEvent $event)
{
$trick = $event->getTrick();
$image = $event->getEntity();
- 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 edit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function edit(Trick $trick, Request $request)
{
$originalTrickImages = $trick->getImages()->count();
/** @var Form $form */
$form = $this->createForm(TrickFormType::class, $trick, [
- 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"