From 1cef45e57d666c4c8f00326ca5d0e96e121980d2 Mon Sep 17 00:00:00 2001 From: Sebastien Curt <sebastien.curt@tetras-libre.fr> Date: Thu, 20 Jan 2022 12:12:14 +0100 Subject: [PATCH] rename capsule.Path get/set to capsule.LinkPath get/set --- src/Builder/CapsuleBuilder.php | 4 ++-- src/Controller/ProjectController.php | 2 +- src/Entity/Capsule.php | 6 +++--- templates/capsule/index.html.twig | 6 +++--- tests/functional/ProjectControllerTest.php | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Builder/CapsuleBuilder.php b/src/Builder/CapsuleBuilder.php index 30be954..83cde2c 100644 --- a/src/Builder/CapsuleBuilder.php +++ b/src/Builder/CapsuleBuilder.php @@ -46,7 +46,7 @@ class CapsuleBuilder public function withPreviewLink(string $preview_link): CapsuleBuilder { - $this->capsule->setPath($preview_link); + $this->capsule->setLinkPath($preview_link); $this->hasRequiredPreviewLink = true; return $this; } @@ -63,7 +63,7 @@ class CapsuleBuilder "The call of CapsuleBuilder::withPassword should be " . "called before CapsuleBuilder::createEditionLink" ); - $this->capsule->setEditionLink($this->capsule->getPath() . + $this->capsule->setEditionLink($this->capsule->getLinkPath() . "/?p=" . $this->capsule->getPassword()); $this->hasRequiredEditionLink = true; } diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php index 6dcc988..e386f39 100644 --- a/src/Controller/ProjectController.php +++ b/src/Controller/ProjectController.php @@ -27,7 +27,7 @@ class ProjectController extends AbstractController chdir('../legacy/'); $capsule_name = $capsule->getName(); - $capsule_directory = $capsule->getPath(); + $capsule_directory = $capsule->getLinkPath(); if (file_exists($capsule_directory)) { $this->addFlash( diff --git a/src/Entity/Capsule.php b/src/Entity/Capsule.php index 6fbe87c..497fa33 100644 --- a/src/Entity/Capsule.php +++ b/src/Entity/Capsule.php @@ -121,14 +121,14 @@ class Capsule return $this; } - public function getPath(): string + public function getLinkPath(): string { return $this->link_path; } - public function setPath(string $preview_link): Capsule + public function setLinkPath(string $link_path): Capsule { - $this->link_path = $preview_link; + $this->link_path = $link_path; return $this; } diff --git a/templates/capsule/index.html.twig b/templates/capsule/index.html.twig index 37abbc1..2a29b76 100644 --- a/templates/capsule/index.html.twig +++ b/templates/capsule/index.html.twig @@ -39,7 +39,7 @@ <div class="capsule-item pb-4 m-5"> <div class="d-flex flex-column flex-md-row justify-content-center align-items-center mt-sm-4"> <div class="list-item"> - <a href="/capsule/preview/{{ capsule.getPath() }}" class="capsule-title"> + <a href="/capsule/preview/{{ capsule.getLinkPath() }}" class="capsule-title"> {{ capsule.getName() }} </a> </div> @@ -51,7 +51,7 @@ <div class="d-flex flex-column flex-md-row justify-content-center align-items-center"> <div class="m-4 ratio ratio-16x9"> <iframe - src="/capsule/preview/{{ capsule.getPath() }}" + src="/capsule/preview/{{ capsule.getLinkPath() }}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> </iframe> @@ -74,7 +74,7 @@ Delete capsule </a> </div> - <a href="capsule/edit/{{ capsule.getPath() }}" class="list-item lh-md"> + <a href="capsule/edit/{{ capsule.getLinkPath() }}" class="list-item lh-md"> <button class="standard-button p-2"> Edit capsule </button> diff --git a/tests/functional/ProjectControllerTest.php b/tests/functional/ProjectControllerTest.php index 7160a29..45d2830 100644 --- a/tests/functional/ProjectControllerTest.php +++ b/tests/functional/ProjectControllerTest.php @@ -117,7 +117,7 @@ class ProjectControllerTest extends WebTestCase } $capsule_name_in_db = $capsule_in_db->getName(); - $capsule_directory = $capsule_in_db->getPath(); + $capsule_directory = $capsule_in_db->getLinkPath(); $this->assertDirectoryExists($capsule_directory); $this->assertDirectoryIsReadable($capsule_directory); @@ -160,7 +160,7 @@ class ProjectControllerTest extends WebTestCase } $capsule_name_in_db = $capsule_in_db->getName(); - $capsule_directory = $capsule_in_db->getPath(); + $capsule_directory = $capsule_in_db->getLinkPath(); $this->assertDirectoryExists($capsule_directory); $this->assertDirectoryIsReadable($capsule_directory); -- GitLab