Passed
Push — master ( 1fe2a6...dabfe1 )
by Chris
01:31
created
php/hamle/Form.php 2 patches
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -64,15 +64,18 @@  discard block
 block discarded – undo
64 64
   
65 65
   function process() {
66 66
     $clicked = "";
67
-    foreach($this->_fields as $f)
68
-      if($f instanceOf Field\Button)
67
+    foreach($this->_fields as $f) {
68
+          if($f instanceOf Field\Button)
69 69
         if($f->isClicked())
70
-          $clicked = $f;
71
-    foreach($this->_fields as $f)
72
-      $f->doProcess($clicked?true:false);
73
-    if($clicked)
74
-      try {
75
-        $this->onSubmit($clicked);
70
+          $clicked = $f;
71
+    }
72
+    foreach($this->_fields as $f) {
73
+          $f->doProcess($clicked?true:false);
74
+    }
75
+    if($clicked) {
76
+          try {
77
+        $this->onSubmit($clicked);
78
+    }
76 79
       } catch(Exception\FormInvalid $e) {
77 80
         $this->hint = $e->getMessage();
78 81
       }
@@ -80,8 +83,9 @@  discard block
 block discarded – undo
80 83
   
81 84
   function isValid() {
82 85
     $valid = true;
83
-    foreach($this->_fields as $f)
84
-      $valid = $f->valid && $valid;
86
+    foreach($this->_fields as $f) {
87
+          $valid = $f->valid && $valid;
88
+    }
85 89
     return $valid;
86 90
   }
87 91
   /**
@@ -95,8 +99,9 @@  discard block
 block discarded – undo
95 99
     return $this->_fields;
96 100
   }
97 101
   function getField($n) {
98
-    if(!isset($this->_fields[$n]))
99
-      throw new Exception\NoKey("unable to find form field ($n)");
102
+    if(!isset($this->_fields[$n])) {
103
+          throw new Exception\NoKey("unable to find form field ($n)");
104
+    }
100 105
     return $this->_fields[$n];
101 106
   }
102 107
   function __get($n) {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     $this->setup();
55 55
     $fields = $this->_fields;
56 56
     $this->_fields = array();
57
-    foreach($fields as $v) {
57
+    foreach ($fields as $v) {
58 58
       $this->_fields[$v->name] = $v;
59 59
       $v->form($this->_name);
60 60
     }
@@ -64,23 +64,23 @@  discard block
 block discarded – undo
64 64
   
65 65
   function process() {
66 66
     $clicked = "";
67
-    foreach($this->_fields as $f)
68
-      if($f instanceOf Field\Button)
69
-        if($f->isClicked())
67
+    foreach ($this->_fields as $f)
68
+      if ($f instanceOf Field\Button)
69
+        if ($f->isClicked())
70 70
           $clicked = $f;
71
-    foreach($this->_fields as $f)
72
-      $f->doProcess($clicked?true:false);
73
-    if($clicked)
71
+    foreach ($this->_fields as $f)
72
+      $f->doProcess($clicked ?true:false);
73
+    if ($clicked)
74 74
       try {
75 75
         $this->onSubmit($clicked);
76
-      } catch(Exception\FormInvalid $e) {
76
+      } catch (Exception\FormInvalid $e) {
77 77
         $this->hint = $e->getMessage();
78 78
       }
79 79
   }
80 80
   
81 81
   function isValid() {
82 82
     $valid = true;
83
-    foreach($this->_fields as $f)
83
+    foreach ($this->_fields as $f)
84 84
       $valid = $f->valid && $valid;
85 85
     return $valid;
86 86
   }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     return $this->_fields;
96 96
   }
97 97
   function getField($n) {
98
-    if(!isset($this->_fields[$n]))
98
+    if (!isset($this->_fields[$n]))
99 99
       throw new Exception\NoKey("unable to find form field ($n)");
100 100
     return $this->_fields[$n];
101 101
   }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
   }
105 105
   
106 106
   function getHTMLProp() {
107
-    return array('action'=>'','method'=>'post','name'=>$this->_name,
107
+    return array('action'=>'', 'method'=>'post', 'name'=>$this->_name,
108 108
                                         'enctype'=>'multipart/form-data');
109 109
   }
110 110
 
Please login to merge, or discard this patch.
php/hamle/Text/Plain.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@
 block discarded – undo
23 23
   }
24 24
 
25 25
   function toHTML($escape = false) {
26
-    if ($this->type == self::TOKEN_CODE)
27
-      return $this->s;
26
+    if ($this->type == self::TOKEN_CODE) {
27
+          return $this->s;
28
+    }
28 29
     return htmlspecialchars($this->s);
29 30
   }
30 31
 }
31 32
\ No newline at end of file
Please login to merge, or discard this patch.
php/hamle/Text/Comparison.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
       $this->param1 = new Text($m[1],Text::TOKEN_HTML);
40 40
       $this->param2 = new Text($m[3],Text::TOKEN_HTML);
41 41
       $this->operator = $m[2];
42
-    } else
43
-      $this->param1 = new Text($s,Text::TOKEN_HTML);
42
+    } else {
43
+          $this->param1 = new Text($s,Text::TOKEN_HTML);
44
+    }
44 45
   }
45 46
 
46 47
 //  function __construct(String $p1, String $p2, $operator) {
@@ -49,7 +50,9 @@  discard block
 block discarded – undo
49 50
 //    $this->operator = $operator;
50 51
 //  }
51 52
   function toPHP() {
52
-    if(!$this->param2) return $this->param1->toPHP();
53
+    if(!$this->param2) {
54
+      return $this->param1->toPHP();
55
+    }
53 56
     $p1 = $this->param1->toPHP();
54 57
     $p2 = $this->param2->toPHP();
55 58
     switch($this->operator) {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 
36 36
   function __construct($s, $mode = self::TOKEN_CONTROL) {
37 37
     $m = array();
38
-    if(preg_match('/^(.*) '.self::REGEX_COMP_OPER.' (.*)$/', $s, $m)) {
39
-      $this->param1 = new Text($m[1],Text::TOKEN_HTML);
40
-      $this->param2 = new Text($m[3],Text::TOKEN_HTML);
38
+    if (preg_match('/^(.*) '.self::REGEX_COMP_OPER.' (.*)$/', $s, $m)) {
39
+      $this->param1 = new Text($m[1], Text::TOKEN_HTML);
40
+      $this->param2 = new Text($m[3], Text::TOKEN_HTML);
41 41
       $this->operator = $m[2];
42 42
     } else
43
-      $this->param1 = new Text($s,Text::TOKEN_HTML);
43
+      $this->param1 = new Text($s, Text::TOKEN_HTML);
44 44
   }
45 45
 
46 46
 //  function __construct(String $p1, String $p2, $operator) {
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 //    $this->operator = $operator;
50 50
 //  }
51 51
   function toPHP() {
52
-    if(!$this->param2) return $this->param1->toPHP();
52
+    if (!$this->param2) return $this->param1->toPHP();
53 53
     $p1 = $this->param1->toPHP();
54 54
     $p2 = $this->param2->toPHP();
55
-    switch($this->operator) {
55
+    switch ($this->operator) {
56 56
       case "equals":
57 57
       case "equal":
58 58
         return $p1." == ".$p2;
Please login to merge, or discard this patch.
php/hamle/Text/Select.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
   function __construct($s) {
32 32
     $s = explode("->", $s, 2);
33 33
     $this->key = $s[0];
34
-    if (count($s) > 1)
35
-      $this->sel = $s[1];
34
+    if (count($s) > 1) {
35
+          $this->sel = $s[1];
36
+    }
36 37
   }
37 38
 }
38 39
\ No newline at end of file
Please login to merge, or discard this patch.
php/hamle/Field/Checkbox.php 2 patches
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,14 +36,18 @@
 block discarded – undo
36 36
   function getInputAttDynamic(&$atts, &$type, &$content) {
37 37
     parent::getInputAttDynamic($atts, $type, $content);
38 38
     $atts['value'] = "ON";
39
-    if ($this->getValue())
40
-      $atts['checked'] = "checked";
39
+    if ($this->getValue()) {
40
+          $atts['checked'] = "checked";
41
+    }
41 42
   }
42 43
 
43 44
   function getValue() {
44
-    if (!is_null($this->setValue)) return $this->setValue;
45
-    if (isset($_REQUEST[$this->form . "__submit"]))
46
-      return isset($_REQUEST[$this->form . "_" . $this->name]);
45
+    if (!is_null($this->setValue)) {
46
+      return $this->setValue;
47
+    }
48
+    if (isset($_REQUEST[$this->form . "__submit"])) {
49
+          return isset($_REQUEST[$this->form . "_" . $this->name]);
50
+    }
47 51
     return $this->opt['default'];
48 52
   }
49 53
 }
50 54
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
42 42
 
43 43
   function getValue() {
44 44
     if (!is_null($this->setValue)) return $this->setValue;
45
-    if (isset($_REQUEST[$this->form . "__submit"]))
46
-      return isset($_REQUEST[$this->form . "_" . $this->name]);
45
+    if (isset($_REQUEST[$this->form."__submit"]))
46
+      return isset($_REQUEST[$this->form."_".$this->name]);
47 47
     return $this->opt['default'];
48 48
   }
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
php/hamle/Setup.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
   public function cachePath($f) {
42 42
     $s = DIRECTORY_SEPARATOR;
43 43
     $dir = implode($s,[__DIR__,"..","..","cache",""]);
44
-    if(!is_dir($dir)) mkdir($dir);
44
+    if(!is_dir($dir)) {
45
+      mkdir($dir);
46
+    }
45 47
     return $dir.$f;
46 48
   }
47 49
 
@@ -67,8 +69,9 @@  discard block
 block discarded – undo
67 69
    * @throws Exception\RunTime
68 70
    */
69 71
   public function getModelTypeID($typeId, $sort = [], $limit = 0, $offset = 0) {
70
-    if(count($typeId) > 1)
71
-      throw new Exception\RunTime("Unable to open more than one ID at a time");
72
+    if(count($typeId) > 1) {
73
+          throw new Exception\RunTime("Unable to open more than one ID at a time");
74
+    }
72 75
     return new Model\Zero();
73 76
   }
74 77
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
    */
41 41
   public function cachePath($f) {
42 42
     $s = DIRECTORY_SEPARATOR;
43
-    $dir = implode($s,[__DIR__,"..","..","cache",""]);
44
-    if(!is_dir($dir)) mkdir($dir);
43
+    $dir = implode($s, [__DIR__, "..", "..", "cache", ""]);
44
+    if (!is_dir($dir)) mkdir($dir);
45 45
     return $dir.$f;
46 46
   }
47 47
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
    * @throws Exception\RunTime
68 68
    */
69 69
   public function getModelTypeID($typeId, $sort = [], $limit = 0, $offset = 0) {
70
-    if(count($typeId) > 1)
70
+    if (count($typeId) > 1)
71 71
       throw new Exception\RunTime("Unable to open more than one ID at a time");
72 72
     return new Model\Zero();
73 73
   }
Please login to merge, or discard this patch.
php/hamle/Model/WrapArray.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,9 @@
 block discarded – undo
35 35
   }
36 36
 
37 37
   function hamleGet($key) {
38
-    if (!isset($this->data[$this->pos][$key]))
39
-      return "Missing Key [$key]";
38
+    if (!isset($this->data[$this->pos][$key])) {
39
+          return "Missing Key [$key]";
40
+    }
40 41
     return $this->data[$this->pos][$key];
41 42
   }
42 43
 
Please login to merge, or discard this patch.
php/hamle/Exception/ParseError.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 
33 33
   function __construct($message = "", $code = 0, $previous = NULL) {
34 34
     ///@todo  Include Line number & file name within parse error exceptions
35
-    $message .= ", on line " . Hamle\Hamle::getLineNo() . " in file ?.hamle";
35
+    $message .= ", on line ".Hamle\Hamle::getLineNo()." in file ?.hamle";
36 36
     parent::__construct($message, $code, $previous);
37 37
   }
38 38
 
Please login to merge, or discard this patch.
php/hamle/Field/Memo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,6 +42,6 @@
 block discarded – undo
42 42
   }
43 43
 
44 44
   function isClicked() {
45
-    return isset($_REQUEST[$this->form . "_" . $this->name]);
45
+    return isset($_REQUEST[$this->form."_".$this->name]);
46 46
   }
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.