-
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TASK: Introduce NodeUri Options in favour of
NodeUriSpecification
The api should be ``` public function uriFor(NodeAddress $nodeAddress, Options $options = null): UriInterface ```
- Loading branch information
Showing
11 changed files
with
142 additions
and
148 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
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
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,64 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\Neos\FrontendRouting\NodeUri; | ||
|
||
/* | ||
* Immutable filter DTO for {@see NodeUriBuilder::uriFor()} | ||
* | ||
* Example: | ||
* | ||
* Options::create(forceAbsolute: true); | ||
* | ||
* @api for the factory methods; NOT for the inner state. | ||
*/ | ||
final readonly class Options | ||
{ | ||
/** | ||
* @internal the properties themselves are readonly; only the write-methods are API. | ||
* @param array<string, mixed> $routingArguments | ||
*/ | ||
private function __construct( | ||
public ?bool $forceAbsolute, | ||
public ?string $format, | ||
public ?array $routingArguments, | ||
) { | ||
} | ||
|
||
/** | ||
* Creates an instance with the specified options | ||
* | ||
* Note: The signature of this method might be extended in the future, so it should always be used with named arguments | ||
* @see https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments | ||
* | ||
* @param array<string, mixed> $routingArguments | ||
*/ | ||
public static function create( | ||
bool $forceAbsolute = null, | ||
string $format = null, | ||
array $routingArguments = null, | ||
): self { | ||
return new self($forceAbsolute, $format, $routingArguments); | ||
} | ||
|
||
/** | ||
* Returns a new instance with the specified additional options | ||
* | ||
* Note: The signature of this method might be extended in the future, so it should always be used with named arguments | ||
* @see https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments | ||
* | ||
* @param array<string, mixed> $routingArguments | ||
*/ | ||
public function with( | ||
bool $forceAbsolute = null, | ||
string $format = null, | ||
array $routingArguments = null, | ||
): self { | ||
return self::create( | ||
$forceAbsolute ?? $this->forceAbsolute, | ||
$format ?? $this->format, | ||
$routingArguments ?? $this->routingArguments, | ||
); | ||
} | ||
} |
45 changes: 0 additions & 45 deletions
45
Neos.Neos/Classes/FrontendRouting/NodeUriSpecification.php
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.