Commit 4b61811b authored by Franco Fichtner's avatar Franco Fichtner

src: style sweep

parent c2cd032c
......@@ -42,7 +42,7 @@ $di->set('view', function () use ($config) {
'compiledSeparator' => '_'
));
// register additional volt template functions
$volt->getCompiler()->addFunction('javascript_include_when_exists', function($local_url) {
$volt->getCompiler()->addFunction('javascript_include_when_exists', function ($local_url) {
$chk_path = "str_replace('/ui/','/usr/local/opnsense/www/',".$local_url.")";
$js_tag = "'<script type=\"text/javascript\" src=\"'.$local_url.'\"></script>'";
return "file_exists(".$chk_path.") ? ".$js_tag." :''";
......
......@@ -76,7 +76,7 @@ class FilterRule
* @param int $maxsize maximum size, cut when longer
* @return string
*/
private function parsePlain($value, $prefix="", $suffix="", $maxsize=null)
private function parsePlain($value, $prefix = "", $suffix = "", $maxsize = null)
{
if (!empty($maxsize) && strlen($value) > $maxsize) {
$value = substr($value, 0, $maxsize);
......@@ -90,7 +90,7 @@ class FilterRule
* @param string $map
* @return string
*/
private function parseReplaceSimple($value, $map, $prefix="", $suffix="")
private function parseReplaceSimple($value, $map, $prefix = "", $suffix = "")
{
$retval = $value;
foreach (explode('|', $map) as $item) {
......@@ -145,7 +145,7 @@ class FilterRule
* @param string $value field value
* @return string
*/
private function parseBool($value, $valueTrue, $valueFalse="")
private function parseBool($value, $valueTrue, $valueFalse = "")
{
if (!empty($value)) {
return !empty($valueTrue) ? $valueTrue . " " : "";
......@@ -201,21 +201,21 @@ class FilterRule
}
if (!isset($tmp['quick'])) {
// all rules are quick by default except floating
$tmp['quick'] = !isset($rule['floating']) ? true : false ;
$tmp['quick'] = !isset($rule['floating']) ? true : false;
}
// restructure state settings for easier output parsing
if (!empty($tmp['statetype'])) {
$tmp['state'] = array('type' => 'keep', 'options' => array());
switch ($tmp['statetype']) {
case 'none':
$tmp['state']['type'] = 'no';
break;
case 'sloppy state':
$tmp['state']['type'] = 'keep';
$tmp['state']['options'][] = "sloppy ";
break;
default:
$tmp['state']['type'] = explode(' ', $tmp['statetype'])[0];
case 'none':
$tmp['state']['type'] = 'no';
break;
case 'sloppy state':
$tmp['state']['type'] = 'keep';
$tmp['state']['options'][] = "sloppy ";
break;
default:
$tmp['state']['type'] = explode(' ', $tmp['statetype'])[0];
}
if (!empty($tmp['nopfsync'])) {
$tmp['state']['options'][] = "no-sync ";
......@@ -254,7 +254,7 @@ class FilterRule
* output rule as string
* @return string ruleset
*/
public function __toString()
public function __toString()
{
$ruleTxt = '';
foreach ($this->fetchActualRules() as $rule) {
......
......@@ -74,7 +74,7 @@ class Plugin
* @param string $placement placement head,tail
* @return null
*/
public function registerAnchor($name, $type="fw", $priority=0, $placement="tail")
public function registerAnchor($name, $type = "fw", $priority = 0, $placement = "tail")
{
$anchorKey = sprintf("%s.%s.%08d.%08d", $type, $placement, $priority, count($this->anchors));
$this->anchors[$anchorKey] = $name;
......@@ -87,7 +87,7 @@ class Plugin
* @param string $placement placement head,tail
* @return string
*/
public function anchorToText($types="fw", $placement="tail")
public function anchorToText($types = "fw", $placement = "tail")
{
$result = "";
foreach (explode(',', $types) as $type) {
......@@ -107,7 +107,7 @@ class Plugin
* @param array $conf configuration
* @param array $defaults merge these defaults when provided
*/
public function registerFilterRule($prio, $conf, $defaults=null)
public function registerFilterRule($prio, $conf, $defaults = null)
{
if ($defaults != null) {
$conf = array_merge($defaults, $conf);
......
......@@ -469,7 +469,7 @@ abstract class BaseModel
if ($messages->count() > 0) {
$exception_msg = "";
foreach ($messages as $msg) {
$exception_msg_part = "[".str_replace("\\", ".", get_class($this)).".".$msg-> getField(). "] " ;
$exception_msg_part = "[".str_replace("\\", ".", get_class($this)).".".$msg-> getField(). "] ";
$exception_msg_part .= $msg->getMessage();
$exception_msg .= "$exception_msg_part\n";
// always log validation errors
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment