Skip to content

Commit

Permalink
Merge pull request #130 from exonet/tsi/gh-126
Browse files Browse the repository at this point in the history
Accept non-canonical zone name in find
  • Loading branch information
robbinjanssen authored Feb 7, 2023
2 parents 16ee03e + 65e5547 commit 2ce37c3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Zone.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@ public function get(?string $recordType = null): ResourceSet
*/
public function find(string $resourceRecordName, ?string $recordType = null): ResourceSet
{
$resourceRecordName = $resourceRecordName === '@' ? $this->zone : $resourceRecordName;
$records = $this->get($recordType);

$foundResources = new ResourceSet($this);

foreach ($records as $record) {
if (
$record->getName() === $resourceRecordName
|| $record->getName() === $resourceRecordName.'.'
|| $record->getName() === sprintf('%s.%s', $resourceRecordName, $this->zone)
) {
$foundResources->addResource($record);
Expand Down

0 comments on commit 2ce37c3

Please sign in to comment.