src: style sweep

This commit is contained in:
Franco Fichtner 2018-07-14 18:04:49 +00:00
parent 7c833ea3d6
commit fdc52df6d5
9 changed files with 19 additions and 20 deletions

View File

@ -1490,13 +1490,10 @@ function openvpn_get_interface_ip($ip, $mask)
// Special case for /31 networks which lack network and broadcast addresses.
// As per RFC3021, both addresses should be treated as host addresses.
if ($masklong == 0xfffffffe)
{
if ($masklong == 0xfffffffe) {
$ip1 = long2ip32($baselong);
$ip2 = long2ip32($baselong + 1);
}
else
{
} else {
$ip1 = long2ip32($baselong + 1);
$ip2 = long2ip32($baselong + 2);
}

View File

@ -28,12 +28,12 @@
*/
namespace OPNsense\Base;
class UserException extends \Exception
{
private $title = null;
public function __construct($message = "", $title = "", $code = 0, Exception $previous = null) {
public function __construct($message = "", $title = "", $code = 0, Exception $previous = null)
{
$this->title = $title;
parent::__construct($message, $code, $previous);
}
@ -45,5 +45,4 @@ class UserException extends \Exception
{
return $this->title;
}
}
}

View File

@ -295,9 +295,9 @@ abstract class Rule
{
if (empty($value)) {
return '';
} else if (empty($this->interfaceMapping[$value]['if'])) {
} elseif (empty($this->interfaceMapping[$value]['if'])) {
return "{$prefix}##{$value}##{$suffix} ";
} else if (!empty($this->interfaceMapping[$value]['ipaddrv6']) &&
} elseif (!empty($this->interfaceMapping[$value]['ipaddrv6']) &&
($this->interfaceMapping[$value]['ipaddrv6'] == '6rd' ||
$this->interfaceMapping[$value]['ipaddrv6'] == '6to4')) {
return "{$prefix}". "{$value}_stf" ."{$suffix} ";

View File

@ -77,7 +77,7 @@ class Util
*/
public static function isAlias($name)
{
if (!empty($name) ){
if (!empty($name)) {
$aliasMdl = new Alias();
// MVC defined aliases
foreach ($aliasMdl->aliases->alias->__items as $alias) {

View File

@ -64,7 +64,8 @@ class CallbackValidator extends Validator implements ValidatorInterface
} else {
// dropout with validation error when we miss a callback
$validator->appendMessage(
new Message(gettext("Configuration error, missing callback in CallbackValidator"),
new Message(
gettext("Configuration error, missing callback in CallbackValidator"),
$attribute,
'CallbackValidator'
)

View File

@ -84,7 +84,7 @@ class Alias extends BaseModel
$cfgsection = $cfgsection->$cfgName;
}
if ($cfgsection != null) {
$nodeidx = 0 ;
$nodeidx = 0;
foreach ($cfgsection as $inode) {
$node = $inode;
foreach ($aliasref[1] as $cfgName) {

View File

@ -117,7 +117,8 @@ class AliasContentField extends BaseField
foreach ($this->getItems($data) as $port) {
if (!Util::isAlias($port) && !Util::isPort($port, true)) {
$messages[] = sprintf(
gettext('Entry "%s" is not a valid port number.'), $port
gettext('Entry "%s" is not a valid port number.'),
$port
);
}
}
@ -135,7 +136,8 @@ class AliasContentField extends BaseField
foreach ($this->getItems($data) as $host) {
if (!Util::isAlias($host) && !Util::isIpAddress($host) && !Util::isDomain($host)) {
$messages[] = sprintf(
gettext('Entry "%s" is not a valid hostname or IP address.'), $host
gettext('Entry "%s" is not a valid hostname or IP address.'),
$host
);
}
}
@ -163,7 +165,8 @@ class AliasContentField extends BaseField
if (!Util::isAlias($network) && !Util::isIpAddress($network) && !Util::isSubnet($network) &&
!($ipaddr_count == 2 && $domain_alias_count == 0)) {
$messages[] = sprintf(
gettext('Entry "%s" is not a valid hostname or IP address.'), $network
gettext('Entry "%s" is not a valid hostname or IP address.'),
$network
);
}
}

View File

@ -33,7 +33,6 @@ use OPNsense\Base\Validators\CallbackValidator;
use Phalcon\Validation\Validator\Regex;
use Phalcon\Validation\Validator\ExclusionIn;
/**
* Class AliasNameField
* @package OPNsense\Base\FieldTypes

View File

@ -62,14 +62,14 @@ class M1_0_0 extends BaseModelMigration
if ($alias->url) {
// url content only contains a single item
$node->content = (string)$alias->url;
} elseif ($alias->aliasurl){
} elseif ($alias->aliasurl) {
// aliasurl in legacy config could consist of multiple <aliasurl> entries
$content = array();
foreach ($alias->aliasurl as $url) {
$content[] = (string)$url;
}
$node->content = implode("\n", $content);
} elseif ($alias->address){
} elseif ($alias->address) {
// address entries
$node->content = str_replace(" ", "\n", (string)$alias->address);
}