Skip to content

Commit

Permalink
Fix typo in getEnvironment method name (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlocati authored Sep 9, 2022
1 parent ec49c33 commit 8a4e52b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
17 changes: 13 additions & 4 deletions src/Check/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function __construct(Environment $environment, Resolver $resolver)
*
* @return \SPFLib\Check\Environment
*/
public function getEnvoronment(): Environment
public function getEnvironment(): Environment
{
return $this->environment;
}
Expand Down Expand Up @@ -148,7 +148,7 @@ public function getSenderDomain(): string
*/
public function getClientIPDomain(): string
{
$ip = $this->getEnvoronment()->getClientIP();
$ip = $this->getEnvironment()->getClientIP();
if ($ip === null) {
return '';
}
Expand Down Expand Up @@ -249,7 +249,7 @@ public function matchDomainIPs(string $domain, ?int $ipv4CidrLength, ?int $ipv6C

public function matchIP(AddressInterface $check, ?int $ipv4CidrLength, ?int $ipv6CidrLength): bool
{
$clientIP = $this->getEnvoronment()->getClientIP();
$clientIP = $this->getEnvironment()->getClientIP();
if ($ipv4CidrLength === 0) {
if ($clientIP instanceof Address\IPv4 && $check instanceof Address\IPv4) {
return true;
Expand Down Expand Up @@ -286,6 +286,15 @@ public function matchIP(AddressInterface $check, ?int $ipv4CidrLength, ?int $ipv
return false;
}

/**
* @deprecated since version 3.1.2
* @see \SPFLib\Check\State::getEnvironment()
*/
public function getEnvoronment(): Environment
{
return $this->getEnvironment();
}

/**
* Get the DNS resolver instance to be used for queries.
*/
Expand All @@ -308,7 +317,7 @@ protected function getPTRPointers(): array

protected function buildPTRQuery(): string
{
$ip = $this->getEnvoronment()->getClientIP();
$ip = $this->getEnvironment()->getClientIP();
if ($ip instanceof Address\IPv4) {
return implode(
'.',
Expand Down
2 changes: 1 addition & 1 deletion src/Check/State/HeloDomainState.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class HeloDomainState extends State
*/
public function getSender(): string
{
$domain = $this->getEnvoronment()->getHeloDomain();
$domain = $this->getEnvironment()->getHeloDomain();

return $domain === '' ? '' : "postmaster@{$domain}";
}
Expand Down
2 changes: 1 addition & 1 deletion src/Check/State/MailFromState.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class MailFromState extends State
*/
public function getSender(): string
{
$mailFrom = $this->getEnvoronment()->getMailFrom();
$mailFrom = $this->getEnvironment()->getMailFrom();
if (($mailFrom[0] ?? '') === '@') {
$mailFrom = 'postmaster' . $mailFrom;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,11 @@ protected function matchMechanismExists(State $state, string $domain, Mechanism\
$targetDomain = $this->expandDomainSpec($state, $domain, $mechanism->getDomainSpec(), false);
$state->countDNSLookup();
foreach ($this->getDNSResolver()->getIPAddressesFromDomainName($targetDomain) as $ip) {
if ($state->getEnvoronment()->getClientIP() instanceof Address\IPv4) {
if ($state->getEnvironment()->getClientIP() instanceof Address\IPv4) {
if ($ip instanceof Address\IPv4) {
return true;
}
} elseif ($state->getEnvoronment()->getClientIP() instanceof Address\IPv6) {
} elseif ($state->getEnvironment()->getClientIP() instanceof Address\IPv6) {
if ($ip instanceof Address\IPv4) {
return true;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Macro/MacroString/Expander.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function getPlaceholderValue(string $macroLetter, string $currentDomai
$value = $currentDomain;
break;
case Chunk\Placeholder::ML_IP:
$ip = $state->getEnvoronment()->getClientIP();
$ip = $state->getEnvironment()->getClientIP();
if ($ip !== null) {
if ($ip instanceof Address\IPv6) {
$value = implode('.', str_split(str_replace(':', '', $ip->toString(true)), 1));
Expand All @@ -116,7 +116,7 @@ protected function getPlaceholderValue(string $macroLetter, string $currentDomai
}
break;
case Chunk\Placeholder::ML_IP_TYPE:
$ip = $state->getEnvoronment()->getClientIP();
$ip = $state->getEnvironment()->getClientIP();
if ($ip === null) {
throw new Exception\MissingEnvironmentValueException(Chunk\Placeholder::ML_IP);
}
Expand All @@ -127,17 +127,17 @@ protected function getPlaceholderValue(string $macroLetter, string $currentDomai
}
break;
case Chunk\Placeholder::ML_HELO_DOMAIN:
$value = $state->getEnvoronment()->getHeloDomain();
$value = $state->getEnvironment()->getHeloDomain();
break;
case Chunk\Placeholder::ML_SMTP_CLIENT_IP:
$ip = $state->getEnvoronment()->getClientIP();
$ip = $state->getEnvironment()->getClientIP();
if ($ip === null) {
throw new Exception\MissingEnvironmentValueException(Chunk\Placeholder::ML_IP);
}
$value = (string) $ip;
break;
case Chunk\Placeholder::ML_CHECKER_DOMAIN:
$value = $state->getEnvoronment()->getCheckerDomain();
$value = $state->getEnvironment()->getCheckerDomain();
break;
case Chunk\Placeholder::ML_CURRENT_TIMESTAMP:
$value = (string) time();
Expand Down

0 comments on commit 8a4e52b

Please sign in to comment.