Completed
Push — master ( c6418a...51b3a1 )
by Chris
03:33
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 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
       self::$namedScopes[$name]->rewind();
68 68
       return self::$namedScopes[$name];
69 69
     } else
70
-      if(self::$returnZeroOnNoScope)
70
+      if (self::$returnZeroOnNoScope)
71 71
         return new Model\Zero();
72 72
       throw new RunTime("Unable to find scope ($name)");
73 73
   }
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/Tag/Comment.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -30,6 +30,9 @@
 block discarded – undo
30 30
 class Comment extends Tag {
31 31
   protected $commentstyle;
32 32
 
33
+  /**
34
+   * @param string $type
35
+   */
33 36
   function __construct($type) {
34 37
     if ($type == "/")
35 38
       $this->commentstyle = "HTML";
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
   function renderContent($pad = "", $oneliner = false) {
43 43
     if ($this->commentstyle == "HTML")
44 44
       if (count($this->content) > 1)
45
-        return $pad . "  " . implode("\n$pad", $this->content) . "\n";
45
+        return $pad."  ".implode("\n$pad", $this->content)."\n";
46 46
       else
47 47
         return current($this->content);
48 48
     return "";
Please login to merge, or discard this patch.
php/hamle/Tag/DynHtml.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -33,6 +33,10 @@
 block discarded – undo
33 33
   protected $varname;
34 34
   protected $baseType;
35 35
 
36
+  /**
37
+   * @param string $tag
38
+   * @param string $id
39
+   */
36 40
   function __construct($tag, $class, $param, $id, $ref) {
37 41
     parent::__construct($tag, $class, $param, $id);
38 42
     $this->source[] = $ref;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
     $this->source[] = $ref;
39 39
     $this->baseType = $tag;
40 40
     self::$var++;
41
-    $this->varname = "\$dynhtml" . self::$var;
41
+    $this->varname = "\$dynhtml".self::$var;
42 42
   }
43 43
 
44 44
   function render($indent = 0, $doIndent = true) {
45 45
     $data = H\Text::varToCode(array("base" => $this->baseType, "type" => $this->type, "opt" => $this->opt, "source" => $this->source, "content" => $this->content));
46
-    $out = "<?php " . $this->varname . "=$data; echo Hamle\\Tag\\DynHtml::toStTag(" . $this->varname . ",\$form).";
47
-    $out .= "implode(\"\\n\"," . $this->varname . "['content']).";
48
-    $out .= "Hamle\\Tag\\DynHtml::toEnTag(" . $this->varname . ",\$form)?>\n";
46
+    $out = "<?php ".$this->varname."=$data; echo Hamle\\Tag\\DynHtml::toStTag(".$this->varname.",\$form).";
47
+    $out .= "implode(\"\\n\",".$this->varname."['content']).";
48
+    $out .= "Hamle\\Tag\\DynHtml::toEnTag(".$this->varname.",\$form)?>\n";
49 49
     return $out;
50 50
   }
51 51
 
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
     foreach ($d["source"] as $source) {
58 58
       $form->getField($source)->getDynamicAtt($d['base'], $d['opt'], $d['type'], $d['content']);
59 59
     }
60
-    $out = "<" . $d['type'] . " ";
60
+    $out = "<".$d['type']." ";
61 61
     foreach ($d['opt'] as $k => $v) {
62 62
       if (is_array($v)) {
63 63
         foreach ($v as $k2 => $v2)
64
-          if ($v[$k2] instanceof Text) $v[$k2] = eval('return ' . $v[$k2]->toPHP() . ';');
64
+          if ($v[$k2] instanceof Text) $v[$k2] = eval('return '.$v[$k2]->toPHP().';');
65 65
         $v = implode(" ", $v);
66 66
       }
67
-      if ($v instanceOf H\Text) $v = eval('return ' . $v->toPHP() . ';');
68
-      $out .= $k . "=\"" . htmlspecialchars($v) . "\" ";
67
+      if ($v instanceOf H\Text) $v = eval('return '.$v->toPHP().';');
68
+      $out .= $k."=\"".htmlspecialchars($v)."\" ";
69 69
     }
70 70
     $out .= in_array($d['type'], self::$selfCloseTags) ? "/>" : ">";
71 71
     return $out;
72 72
   }
73 73
 
74 74
   static function toEnTag($d, $form) {
75
-    return in_array($d['type'], self::$selfCloseTags) ? "" : "</" . $d['type'] . ">";
75
+    return in_array($d['type'], self::$selfCloseTags) ? "" : "</".$d['type'].">";
76 76
   }
77 77
 }
78 78
\ No newline at end of file
Please login to merge, or discard this patch.
php/hamle/Tag/Filter.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -38,6 +38,9 @@
 block discarded – undo
38 38
    */
39 39
   protected $filter;
40 40
 
41
+  /**
42
+   * @param string $tag
43
+   */
41 44
   function __construct($tag) {
42 45
     parent::__construct();
43 46
     $this->type = ucfirst(strtolower($tag));
Please login to merge, or discard this patch.
php/hamle/Tag/Form.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -38,6 +38,9 @@
 block discarded – undo
38 38
    */
39 39
   protected $form;
40 40
 
41
+  /**
42
+   * @param string $param
43
+   */
41 44
   function __construct($param) {
42 45
     parent::__construct();
43 46
     $param = explode(' ', $param);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     foreach ($labelTags as $tag)
62 62
       if ($tag instanceOf Html)
63 63
         foreach ($tag->source as $source) {
64
-          if(isset($fields[$source]))
64
+          if (isset($fields[$source]))
65 65
             $fields[$source]->getLabelAttStatic($tag->opt, $tag->type, $tag->content);
66 66
           else
67 67
             $tag->opt['style'] = "display:none;";
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     foreach ($inputTags as $tag)
71 71
       if ($tag instanceOf Html)
72 72
         foreach ($tag->source as $source) {
73
-          if(isset($fields[$source]))
73
+          if (isset($fields[$source]))
74 74
             $fields[$source]->getHintAttStatic($tag->opt, $tag->type, $tag->content);
75 75
           else
76 76
             $tag->opt['style'] = "display:none;";
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     foreach ($inputTags as $tag)
80 80
       if ($tag instanceOf Html)
81 81
         foreach ($tag->source as $source) {
82
-          if(isset($fields[$source])) {
82
+          if (isset($fields[$source])) {
83 83
             $fields[$source]->getInputAttStatic($tag->opt, $tag->type, $tag->content);
84 84
             unset($fields[$source]);
85 85
           } else
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
         }
88 88
     foreach ($fields as $n => $f) {
89 89
       if (!$f instanceOf Button) {
90
-        $this->addChild($label = new DynHtml("label", [],[],"",$n));
90
+        $this->addChild($label = new DynHtml("label", [], [], "", $n));
91 91
         $f->getLabelAttStatic($label->opt, $label->type, $label->content);
92 92
       }
93
-      $this->addChild($input = new DynHtml("input", [],[],"",$n));
93
+      $this->addChild($input = new DynHtml("input", [], [], "", $n));
94 94
       $f->getInputAttStatic($input->opt, $input->type, $input->content);
95 95
     }
96
-    return "<form " . implode(" ", $out) . "><?php \$form = " . $this->var->toPHP() . "; \$form->process(); ?>";
96
+    return "<form ".implode(" ", $out)."><?php \$form = ".$this->var->toPHP()."; \$form->process(); ?>";
97 97
   }
98 98
 
99 99
   function renderEnTag() {
Please login to merge, or discard this patch.
php/hamle/Tag/Snippet.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -30,6 +30,9 @@
 block discarded – undo
30 30
 class Snippet extends Hamle\Tag {
31 31
   protected $path;
32 32
 
33
+  /**
34
+   * @param string $params
35
+   */
33 36
   function __construct($params) {
34 37
     parent::__construct();
35 38
     if (!preg_match('/^(append|content|prepend|replace)(?: (.*))?$/', $params, $m))
Please login to merge, or discard this 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/Tag/Text.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -33,11 +33,17 @@
 block discarded – undo
33 33
 class Text extends Tag {
34 34
   protected $escape = true;
35 35
 
36
+  /**
37
+   * @param string $tag
38
+   */
36 39
   function __construct($tag) {
37 40
     parent::__construct();
38 41
     $this->escape = ($tag == "_");
39 42
   }
40 43
 
44
+  /**
45
+   * @param string $s
46
+   */
41 47
   function addContent($s, $strtype = H\Text::TOKEN_HTML) {
42 48
     if (trim($s)) {
43 49
       if ($this->escape) {
Please login to merge, or discard this patch.