updrade with rector
This commit is contained in:
@@ -2,36 +2,33 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Repository\ProjectsRepository;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use App\Repository\ProjectsRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ProjectsController extends AbstractController
|
||||
{
|
||||
#[Route(path: '/projects/{name}', name: 'app_projects')]
|
||||
public function index(ProjectsRepository $projectsRepository, string $name = ''): Response
|
||||
{
|
||||
if ($name == '') {
|
||||
return $this->render(view: 'projects/index.html.twig', parameters: [
|
||||
'projects' => $projectsRepository->findAll()
|
||||
]);
|
||||
} else {
|
||||
if ($project = $projectsRepository->findOneByName(value: $name)) {
|
||||
$readMe = file_get_contents(filename: $project->getURL() . '/raw/branch/master/README.md');
|
||||
|
||||
//$parsedReadMe = $markdownParser->transformMarkdown(text: $readMe);
|
||||
|
||||
return $this->render(view: 'projects/show.html.twig', parameters: [
|
||||
'project' => $project,
|
||||
'readme' => $readMe
|
||||
]);
|
||||
} else {
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[Route(path: '/projects/{name}', name: 'app_projects')]
|
||||
public function index(ProjectsRepository $projectsRepository, string $name = ''): Response
|
||||
{
|
||||
if ($name == '') {
|
||||
return $this->render(view: 'projects/index.html.twig', parameters: [
|
||||
'projects' => $projectsRepository->findAll(),
|
||||
]);
|
||||
} else {
|
||||
if ($project = $projectsRepository->findOneByName(value: $name)) {
|
||||
$readMe = file_get_contents(filename: $project->getURL().'/raw/branch/master/README.md');
|
||||
|
||||
// $parsedReadMe = $markdownParser->transformMarkdown(text: $readMe);
|
||||
|
||||
return $this->render(view: 'projects/show.html.twig', parameters: [
|
||||
'project' => $project,
|
||||
'readme' => $readMe,
|
||||
]);
|
||||
} else {
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user