for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Acacha\ForgePublish\Commands\Traits;
/**
* Trait DNSisAlreadyConfigured
*
* @package Acacha\ForgePublish\Commands\Traits
*/
trait DNSisAlreadyConfigured
{
* Check if DNS is already configured.
* @param null $domain
* @param null $ip
* @return bool
protected function dnsResolutionIsOk($domain = null, $ip = null)
if ($this->dnsAlreadyResolved) {
dnsAlreadyResolved
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
return true;
}
$domain = $domain ? $domain: $this->obtainDomain();
$ip = $ip ? $ip: $this->obtainIp();
if ($domain != null && $ip != null) {
$resolved_ip = gethostbyname($domain);
if ($resolved_ip != $domain && $resolved_ip == $ip) {
$this->dnsAlreadyResolved = true;
return false;
* Obtain domain.
* @return mixed
protected function obtainDomain()
return $this->domain ? $this->domain : fp_env('ACACHA_FORGE_DOMAIN', null);
domain
* Obtain IP.
protected function obtainIp()
return $this->ip ? $this->ip : fp_env('ACACHA_FORGE_IP_ADDRESS', null);
ip
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: