Completed
Push — master ( 7c00f5...71a0d5 )
by Chris
02:31
created
php/hamle/Field.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -110,6 +110,9 @@  discard block
 block discarded – undo
110 110
     }
111 111
   }
112 112
 
113
+  /**
114
+   * @return string
115
+   */
113 116
   function getValue() {
114 117
     if (!is_null($this->setValue)) return $this->setValue;
115 118
     if (isset($_REQUEST[$this->form . "_" . $this->name])) {
@@ -173,6 +176,9 @@  discard block
 block discarded – undo
173 176
     }
174 177
   }
175 178
 
179
+  /**
180
+   * @param boolean $submit
181
+   */
176 182
   function doProcess($submit) {
177 183
     if ($submit) {
178 184
       $value = $this->getValue();
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -112,19 +112,19 @@  discard block
 block discarded – undo
112 112
 
113 113
   function getValue() {
114 114
     if (!is_null($this->setValue)) return $this->setValue;
115
-    if (isset($_REQUEST[$this->form . "_" . $this->name])) {
115
+    if (isset($_REQUEST[$this->form."_".$this->name])) {
116 116
       if (get_magic_quotes_runtime())
117
-        return stripslashes($_REQUEST[$this->form . "_" . $this->name]);
117
+        return stripslashes($_REQUEST[$this->form."_".$this->name]);
118 118
       else
119
-        return $_REQUEST[$this->form . "_" . $this->name];
119
+        return $_REQUEST[$this->form."_".$this->name];
120 120
     }
121 121
     return $this->opt['default'];
122 122
   }
123 123
 
124 124
   function getInputAttStatic(&$atts, &$type, &$content) {
125
-    $atts['id'] = $atts['name'] = $this->form . "_" . $this->name;
125
+    $atts['id'] = $atts['name'] = $this->form."_".$this->name;
126 126
     $atts['type'] = "text";
127
-    $atts['class'][] = str_replace(['Seufert\\','\\'],['','_'],get_class($this));
127
+    $atts['class'][] = str_replace(['Seufert\\', '\\'], ['', '_'], get_class($this));
128 128
   }
129 129
 
130 130
   function getInputAttDynamic(&$atts, &$type, &$content) {
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
   }
143 143
 
144 144
   function getLabelAttStatic(&$atts, &$type, &$content) {
145
-    $atts['class'][] = str_replace(['Seufert\\','\\'],['','_'],get_class($this));
146
-    $atts["for"] = $this->form . "_" . $this->name;
145
+    $atts['class'][] = str_replace(['Seufert\\', '\\'], ['', '_'], get_class($this));
146
+    $atts["for"] = $this->form."_".$this->name;
147 147
     $content = array($this->opt['label']);
148 148
   }
149 149
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
   }
152 152
 
153 153
   function getHintAttStatic(&$atts, &$type, &$content) {
154
-    $atts['class'][] = str_replace(['Seufert\\','\\'],['','_'],get_class($this));
154
+    $atts['class'][] = str_replace(['Seufert\\', '\\'], ['', '_'], get_class($this));
155 155
     $atts['class'][] = "hamleFormHint";
156 156
   }
157 157
 
Please login to merge, or discard this patch.
php/hamle/Scope.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -17,6 +17,9 @@
 block discarded – undo
17 17
   /** @var Model[] Assoc array of Models by Scope Name */
18 18
   static $namedScopes = array();
19 19
 
20
+  /**
21
+   * @param Model $model
22
+   */
20 23
   static function add($model, $name = null) {
21 24
     if (!$model instanceOf Model)
22 25
       throw new Unsupported("Unsupported Model (".get_class($model)."), Needs to implement hamleModel Interface");
Please login to merge, or discard this patch.
php/hamle/Setup.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
   /**
49 49
    * Open the default model when only an ID is specified in the template
50 50
    *
51
-   * @param mixed $id Identifier when no type is passed
52
-   * @param array $sort
51
+   * @param string $id Identifier when no type is passed
52
+   * @param integer $sort
53 53
    * @param int $limit Results Limit
54 54
    * @param int $offset Results Offset
55 55
    * @return Model Instance of model class that implements hamleModel
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
    * Open a specific model type with id
61 61
    *
62 62
    * @param array[] $typeId Type ID array [type=>[id]] or [page=>[3]]
63
-   * @param array $sort
63
+   * @param integer $sort
64 64
    * @param int $limit Results Limit
65 65
    * @param int $offset Results Offset
66 66
    * @return Model
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
    * Return Iterator containing results from search of tags
77 77
    *
78 78
    * @param array[] $typeTags Type Tag Array [type=>[tag1,tag2],type2=>[]]
79
-   * @param array $sort
79
+   * @param integer $sort
80 80
    * @param int $limit Results Limit
81 81
    * @param int $offset Results Limit
82 82
    * @return Model Instance of Iterable model class
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/Text/Plain.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -13,6 +13,9 @@
 block discarded – undo
13 13
   protected $s;
14 14
   protected $type;
15 15
 
16
+  /**
17
+   * @param string $s
18
+   */
16 19
   function __construct($s, $type = self::TOKEN_HTML) {
17 20
     $this->s = str_replace('\\$', "$", $s);
18 21
     $this->type = $type;
Please login to merge, or discard this patch.
php/hamle/Tag/Snippet.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 
46 46
   static function decodeClassId($s) {
47 47
     $out = $m = array();
48
-    if(preg_match('/^[a-zA-Z0-9\_]+/', $s, $m))
48
+    if (preg_match('/^[a-zA-Z0-9\_]+/', $s, $m))
49 49
       $out['type'] = $m[0];
50 50
     preg_match_all('/[#\.][a-zA-Z0-9\-\_]+/m', $s, $m);
51 51
     if (isset($m[0])) foreach ($m[0] as $s) {
Please login to merge, or discard this patch.
php/hamle/Text/Comparison.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -13,6 +13,9 @@
 block discarded – undo
13 13
   protected $s;
14 14
   protected $type;
15 15
 
16
+  /**
17
+   * @param string $s
18
+   */
16 19
   function __construct($s, $type = self::TOKEN_HTML) {
17 20
     $this->s = str_replace('\\$', "$", $s);
18 21
     $this->type = $type;
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/Complex.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -13,6 +13,9 @@
 block discarded – undo
13 13
   protected $s;
14 14
   protected $type;
15 15
 
16
+  /**
17
+   * @param string $s
18
+   */
16 19
   function __construct($s, $type = self::TOKEN_HTML) {
17 20
     $this->s = str_replace('\\$', "$", $s);
18 21
     $this->type = $type;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
   protected $filter;
35 35
 
36 36
   function __construct($s) {
37
-    if(FALSE !== $pos = strpos($s,'|')) {
38
-      $this->filter = new Filter(substr($s, $pos+1), $this);
39
-      $s = substr($s,0,$pos);
37
+    if (FALSE !== $pos = strpos($s, '|')) {
38
+      $this->filter = new Filter(substr($s, $pos + 1), $this);
39
+      $s = substr($s, 0, $pos);
40 40
     }
41 41
     $s = explode("->", $s);
42
-    if(count($s) == 1) $s = explode("-!",$s[0]);
42
+    if (count($s) == 1) $s = explode("-!", $s[0]);
43 43
     if (!$s[0]) throw new ParseError("Unable to parse Complex Expression");
44 44
     if ($s[0][1] == "(")
45 45
       $this->func = new Text\Func($s[0]);
@@ -52,19 +52,19 @@  discard block
 block discarded – undo
52 52
   }
53 53
 
54 54
   function toHTML($escape = false) {
55
-    if($escape)
56
-      return "<?=htmlspecialchars(" .$this->toPHP() . ")?>";
57
-    return "<?=" . $this->toPHP() . "?>";
55
+    if ($escape)
56
+      return "<?=htmlspecialchars(".$this->toPHP().")?>";
57
+    return "<?=".$this->toPHP()."?>";
58 58
   }
59 59
   function toPHP() {
60
-    return $this->filter?$this->filter->toPHP():$this->toPHPVar();
60
+    return $this->filter ? $this->filter->toPHP() : $this->toPHPVar();
61 61
   }
62 62
   function toPHPVar() {
63 63
     if ($this->sel) {
64 64
       $sel = array();
65 65
       foreach ($this->sel as $s)
66 66
         $sel[] = "hamleGet('$s')";
67
-      return $this->func->toPHP() . "->" . implode('->', $sel);
67
+      return $this->func->toPHP()."->".implode('->', $sel);
68 68
     } else
69 69
       return $this->func->toPHP();
70 70
   }
Please login to merge, or discard this patch.
php/hamle/Text/Filter.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -13,6 +13,9 @@
 block discarded – undo
13 13
   protected $s;
14 14
   protected $type;
15 15
 
16
+  /**
17
+   * @param string $s
18
+   */
16 19
   function __construct($s, $type = self::TOKEN_HTML) {
17 20
     $this->s = str_replace('\\$', "$", $s);
18 21
     $this->type = $type;
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
   protected $what;
39 39
 
40 40
   function __construct($s, Text $what) {
41
-    if(preg_match("/^([a-z]+)(\\((.*)\\))?$/", $s, $m)) {
41
+    if (preg_match("/^([a-z]+)(\\((.*)\\))?$/", $s, $m)) {
42 42
       $this->filter = $m[1];
43 43
       $this->vars = isset($m[3]) ? explode(',', $m[3]) : [];
44 44
     } else {
45 45
       throw new ParseError("Unable to parse filter expression \"$s\"");
46 46
     }
47
-    if(!in_array($this->filter, ['itersplit', 'newlinebr', 'round', 'strtoupper', 'strtolower', 'ucfirst'])) {
47
+    if (!in_array($this->filter, ['itersplit', 'newlinebr', 'round', 'strtoupper', 'strtolower', 'ucfirst'])) {
48 48
       throw new ParseError("Unknown Filter Type \"{$this->filter}\"");
49 49
     }
50
-    switch($this->filter) {
50
+    switch ($this->filter) {
51 51
       case "itersplit":
52 52
         $this->filter = "Seufert\\Hamle\\Text\\Filter::iterSplit";
53 53
         break;
@@ -59,29 +59,29 @@  discard block
 block discarded – undo
59 59
   }
60 60
 
61 61
   function toHTML($escape = false) {
62
-    if($escape)
63
-      return "<?=htmlspecialchars(" .$this->toPHP() . ")?>";
64
-    return "<?=" . $this->toPHP() . "?>";
62
+    if ($escape)
63
+      return "<?=htmlspecialchars(".$this->toPHP().")?>";
64
+    return "<?=".$this->toPHP()."?>";
65 65
   }
66 66
 
67 67
   function toPHP() {
68
-    $o = [$this->what->toPHPVar()] ;
69
-    foreach($this->vars as $v)
68
+    $o = [$this->what->toPHPVar()];
69
+    foreach ($this->vars as $v)
70 70
       $o[] = $this->varToCode($v);
71
-    return "{$this->filter}(" . implode(',',$o) . ")";
71
+    return "{$this->filter}(".implode(',', $o).")";
72 72
   }
73 73
 
74 74
   static function iterSplit($v, $sep = ",") {
75 75
     $o = [];
76
-    foreach(explode($sep, $v) as $k=>$i) {
77
-      if($i)
78
-        $o[] = ['v'=>trim($i), 'value'=>trim($i), 'k'=>$k,'key'=>$k];
76
+    foreach (explode($sep, $v) as $k=>$i) {
77
+      if ($i)
78
+        $o[] = ['v'=>trim($i), 'value'=>trim($i), 'k'=>$k, 'key'=>$k];
79 79
     }
80 80
     return new WrapArray($o);
81 81
   }
82 82
 
83 83
   static function newlineBr($v) {
84
-    return str_replace("\n","<br />\n",$v);
84
+    return str_replace("\n", "<br />\n", $v);
85 85
   }
86 86
 
87 87
 }
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
php/autoload.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@
 block discarded – undo
34 34
  * @param string $class Class name to be autoloaded
35 35
  */
36 36
 spl_autoload_register(function($class) {
37
-  if(strpos($class, "Seufert\\Hamle\\") === 0) {
37
+  if (strpos($class, "Seufert\\Hamle\\") === 0) {
38 38
     $s = DIRECTORY_SEPARATOR;
39
-    $class = str_replace("\\",$s,substr($class,14));
39
+    $class = str_replace("\\", $s, substr($class, 14));
40 40
     $path = __DIR__.$s."hamle".$s."$class.php";
41
-    if(is_file($path)) include_once($path);
41
+    if (is_file($path)) include_once($path);
42 42
   }
43
-},true,true);
43
+},true, true);
44 44
 
Please login to merge, or discard this patch.