-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Introduce
DetailPageLink
object + factory
- Loading branch information
Showing
5 changed files
with
107 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Extcode\Cart\Domain\Model\Cart; | ||
|
||
/* | ||
* This file is part of the package extcode/cart. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
final class DetailPageLink | ||
{ | ||
public function __construct( | ||
protected int $pageUid, | ||
protected string $extensionName = '', | ||
protected string $pluginName = '', | ||
protected string $controller = '' | ||
) | ||
{} | ||
|
||
public function getPageUid(): int | ||
{ | ||
return $this->pageUid; | ||
} | ||
|
||
public function getExtensionName(): string | ||
{ | ||
return $this->extensionName; | ||
} | ||
|
||
public function getPluginName(): string | ||
{ | ||
return $this->pluginName; | ||
} | ||
|
||
public function getController(): string | ||
{ | ||
return $this->controller; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Extcode\Cart\Domain\Model\Cart; | ||
|
||
/* | ||
* This file is part of the package extcode/cart. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
class DetailPageLinkFactory implements DetailPageLinkFactoryInterface | ||
{ | ||
public function getDetailPageLink( | ||
int $detailPageUid, | ||
string $extensionName = '', | ||
string $pluginName = '', | ||
string $controller = '' | ||
): ?DetailPageLink | ||
{ | ||
if ($detailPageUid > 0) { | ||
return new DetailPageLink($detailPageUid, $extensionName, $pluginName, $controller); | ||
} | ||
return null; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Classes/Domain/Model/Cart/DetailPageLinkFactoryInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Extcode\Cart\Domain\Model\Cart; | ||
|
||
/* | ||
* This file is part of the package extcode/cart. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
interface DetailPageLinkFactoryInterface | ||
{ | ||
public function getDetailPageLink( | ||
int $detailPageUid, | ||
string $extensionName = '', | ||
string $pluginName = '', | ||
string $controller = '' | ||
): ?DetailPageLink; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters