Completed
Branch master (d0b352)
by Joschi
04:27
created
demo/micrometa.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
  *
52 52
  * @param \stdClass $object Object
53 53
  * @param \boolean $link Link values
54
- * @return \string                    HTML
54
+ * @return string                    HTML
55 55
  */
56 56
 function tree($object, $link = false)
57 57
 {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -457,9 +457,11 @@
 block discarded – undo
457 457
                     elseif ($format == 'json'):
458 458
                         ?>
459 459
                         <pre><?= htmlspecialchars($micrometa->toJSON(true)); ?></pre><?php
460
-                    else:
460
+                    else {
461
+                        :
461 462
 
462 463
                         $micro = $micrometa->toObject();
464
+                    }
463 465
 
464 466
                         // Items
465 467
                         ?>
Please login to merge, or discard this patch.
src/Jkphl/Micrometa.php 1 patch
Doc Comments   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
     /**
299 299
      * Convenienve method extracting author data according to the microformats authorship algorithm
300 300
      *
301
-     * @param \int $entry h-entry index
301
+     * @param integer $entry h-entry index
302 302
      * @return Mf2Item Author micro information item
303 303
      * @see http://indiewebcamp.com/authorship
304 304
      */
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
     /**
404 404
      * Return a list of related resources of a particular type (or a single item out of this list)
405 405
      *
406
-     * @param \string $type Resource type
406
+     * @param string $type Resource type
407 407
      * @param \int|NULL $index Optional: list index
408
-     * @return \mixed                        Resource or resource list
408
+     * @return string                        Resource or resource list
409 409
      */
410 410
     public function rel($type, $index = null)
411 411
     {
@@ -465,9 +465,6 @@  discard block
 block discarded – undo
465 465
     /**
466 466
      * Return the first micro information item (of a specific type)
467 467
      *
468
-     * @param \string $type1 Optional: Arbitrary number of item types
469
-     * @param \string $type2
470
-     * ...
471 468
      * @return Item        First micro information item of the resulting list
472 469
      */
473 470
     public function item()
@@ -480,7 +477,7 @@  discard block
 block discarded – undo
480 477
      * Return a JSON representation of the embedded micro information
481 478
      *
482 479
      * @param \boolean $beautify Beautify the JSON output (available since PHP 5.4)
483
-     * @return \string                    JSON representation
480
+     * @return string                    JSON representation
484 481
      */
485 482
     public function toJSON($beautify = false)
486 483
     {
@@ -561,7 +558,6 @@  discard block
 block discarded – undo
561 558
     /**
562 559
      * Return a list of top level micro information items
563 560
      *
564
-     * @param \string $type Optional: Arbitrary number of item types
565 561
      * @return \array Micro information item list
566 562
      */
567 563
     public function items()
Please login to merge, or discard this patch.
src/Jkphl/Micrometa/Item.php 2 patches
Doc Comments   +6 added lines, -10 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * Constructor
102 102
      *
103 103
      * @param \array $data Item data
104
-     * @param string|Url $url Item base URL
104
+     * @param Url $url Item base URL
105 105
      */
106 106
     public function __construct(array $data, Url $url)
107 107
     {
@@ -154,8 +154,7 @@  discard block
 block discarded – undo
154 154
     /**
155 155
      * Check if this item is of a specific type
156 156
      *
157
-     * @param \string $type List of type names (arbitrary length)
158
-     * @return \boolean                If this item is of a specific type
157
+     * @return boolean                If this item is of a specific type
159 158
      */
160 159
     public function isOfType()
161 160
     {
@@ -169,9 +168,6 @@  discard block
 block discarded – undo
169 168
     /**
170 169
      * Return the first available property in a list of properties
171 170
      *
172
-     * @param \string $property1 First property
173
-     * @param \string $property2 Second property
174
-     * ...
175 171
      * @return \mixed                Property value
176 172
      */
177 173
     public function firstOf()
@@ -212,7 +208,7 @@  discard block
 block discarded – undo
212 208
     /**
213 209
      * String serialization as JSON object
214 210
      *
215
-     * @return \string                String serialization as JSON object
211
+     * @return string                String serialization as JSON object
216 212
      */
217 213
     public function __toString()
218 214
     {
@@ -223,7 +219,7 @@  discard block
 block discarded – undo
223 219
      * Return a JSON representation of the embedded micro information
224 220
      *
225 221
      * @param \boolean $beautify Beautify the JSON output (available since PHP 5.4)
226
-     * @return \string                    JSON representation
222
+     * @return string                    JSON representation
227 223
      */
228 224
     public function toJSON($beautify = false)
229 225
     {
@@ -272,7 +268,7 @@  discard block
 block discarded – undo
272 268
      * Check if a subelement is a microcontent item itself
273 269
      *
274 270
      * @param \mixed $item Subelement
275
-     * @return \boolean                Is an item
271
+     * @return boolean                Is an item
276 272
      */
277 273
     protected function _isItem($item)
278 274
     {
@@ -296,7 +292,7 @@  discard block
 block discarded – undo
296 292
     /**
297 293
      * Sanitize URL values
298 294
      *
299
-     * @param \string $property Property name
295
+     * @param string $property Property name
300 296
      * @param \mixed $value Value
301 297
      * @return mixed                URL resolved value
302 298
      */
Please login to merge, or discard this patch.
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                 if (is_array($values)) {
117 117
                     $property = lcfirst(implode('', array_map('ucfirst', explode('-', $property))));
118 118
                     $this->_properties->$property = array();
119
-                    $propertyValues =& $this->_properties->$property;
119
+                    $propertyValues = & $this->_properties->$property;
120 120
                     $hasSubItems = false;
121 121
                     foreach ($values as $value) {
122 122
                         if ($this->_isItem($value)) {
@@ -126,8 +126,7 @@  discard block
 block discarded – undo
126 126
                     }
127 127
                     foreach ($values as $value) {
128 128
                         $propertyValues[] = $hasSubItems ?
129
-                            (($value instanceof ItemInterface) ? $value : new $classname((array)$value, $this->_url)) :
130
-                            $this->_resolveUrlValue($property, $value);
129
+                            (($value instanceof ItemInterface) ? $value : new $classname((array)$value, $this->_url)) : $this->_resolveUrlValue($property, $value);
131 130
                     }
132 131
                 }
133 132
             }
@@ -196,7 +195,7 @@  discard block
 block discarded – undo
196 195
 
197 196
         // If a single property value was requested
198 197
         if (isset($this->_properties->$key)) {
199
-            $property =& $this->_properties->$key;
198
+            $property = & $this->_properties->$key;
200 199
             return $property[0];
201 200
 
202 201
             // Else: If a property value list was requested
Please login to merge, or discard this patch.
src/Jkphl/Micrometa/ItemInterface.php 1 patch
Doc Comments   +5 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,24 +54,21 @@  discard block
 block discarded – undo
54 54
      * Constructor
55 55
      *
56 56
      * @param \array $data Item data
57
-     * @param string|Url $url Item base URL
57
+     * @param Url $url Item base URL
58
+     * @return void
58 59
      */
59 60
     public function __construct(array $data, Url $url);
60 61
 
61 62
     /**
62 63
      * Check if this item is of a specific type
63 64
      *
64
-     * @param \string $type List of type names (arbitrary length)
65
-     * @return \boolean                If this item is of a specific type
65
+     * @return boolean                If this item is of a specific type
66 66
      */
67 67
     public function isOfType();
68 68
 
69 69
     /**
70 70
      * Return the first available property in a list of properties
71 71
      *
72
-     * @param \string $property1 First property
73
-     * @param \string $property2 Second property
74
-     * ...
75 72
      * @return \mixed                Property value
76 73
      */
77 74
     public function firstOf();
@@ -87,7 +84,7 @@  discard block
 block discarded – undo
87 84
     /**
88 85
      * String serialization as JSON object
89 86
      *
90
-     * @return \string                String serialization as JSON object
87
+     * @return string                String serialization as JSON object
91 88
      */
92 89
     public function __toString();
93 90
 
@@ -95,7 +92,7 @@  discard block
 block discarded – undo
95 92
      * Return a JSON representation of the embedded micro information
96 93
      *
97 94
      * @param \boolean $beautify Beautify the JSON output (available since PHP 5.4)
98
-     * @return \string                    JSON representation
95
+     * @return string                    JSON representation
99 96
      */
100 97
     public function toJSON($beautify = false);
101 98
 
Please login to merge, or discard this patch.
src/Jkphl/Micrometa/Parser/JsonLD.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,8 @@
 block discarded – undo
91 91
     /**
92 92
      * Constructor
93 93
      *
94
-     * @param Document|string $source The data to parse. A string of HTML or a DOMDocument
95
-     * @param Url|\string $url Optional: The URL of the parsed document, for relative URL resolution
94
+     * @param \DOMDocument $source The data to parse. A string of HTML or a DOMDocument
95
+     * @param Url $url Optional: The URL of the parsed document, for relative URL resolution
96 96
      */
97 97
     public function __construct($source, $url)
98 98
     {
Please login to merge, or discard this patch.
src/Jkphl/Micrometa/Parser/Microdata.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
     /**
89 89
      * Constructor
90 90
      *
91
-     * @param Url|\string $url Document URL
91
+     * @param string $url Document URL
92 92
      * @param \string $source Optional: Document source code
93 93
      * @return void
94 94
      */
Please login to merge, or discard this patch.
src/Jkphl/Micrometa/Parser/Microdata/Element.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     /**
123 123
      * Split an attribute value by whitespace and return as token list
124 124
      *
125
-     * @param \string $str Attribute value
125
+     * @param string $string
126 126
      * @return array                 Token list
127 127
      */
128 128
     protected function _tokenList($string)
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     /**
134 134
      * Return the item's ID
135 135
      *
136
-     * @return \string|NULL         Item ID
136
+     * @return string|null         Item ID
137 137
      */
138 138
     public function itemId()
139 139
     {
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     /**
175 175
      * Test if this item creates a new scope
176 176
      *
177
-     * @return \boolean             Item creates a new scope
177
+     * @return boolean             Item creates a new scope
178 178
      */
179 179
     public function itemScope()
180 180
     {
Please login to merge, or discard this patch.
src/Jkphl/Micrometa/Parser/Microformats2.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     /**
78 78
      * Constructor
79 79
      *
80
-     * @param \DOMDocument|string $source The data to parse. A string of HTML or a DOMDocument
80
+     * @param \DOMDocument $source The data to parse. A string of HTML or a DOMDocument
81 81
      * @param Url|\string $url Optional: The URL of the parsed document, for relative URL resolution
82 82
      */
83 83
     public function __construct($source, $url = null)
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      *
92 92
      * @param \string $vocable Vocable
93 93
      * @param \string $separator Separation char / vocable
94
-     * @return \string Decamelized vocable
94
+     * @return string Decamelized vocable
95 95
      * @throws Exception If it's not a valid microformats2 vocable
96 96
      */
97 97
     public static function decamelize($vocable, $separator = '-')
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      * Check if a string is a valid microformats2 vocable (regular or camelCased)
114 114
      *
115 115
      * @param \string $str String
116
-     * @return \boolean                                Whether it's a valid microformats2 vocable
116
+     * @return boolean                                Whether it's a valid microformats2 vocable
117 117
      */
118 118
     public static function isValidVocable($str)
119 119
     {
Please login to merge, or discard this patch.
src/Jkphl/Utility/Url.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     /**
188 188
      * Return whether this URL is relative
189 189
      *
190
-     * @return \boolean                            Whether this URL is relative
190
+     * @return boolean                            Whether this URL is relative
191 191
      */
192 192
     public function isRelative()
193 193
     {
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     /**
287 287
      * String serialization
288 288
      *
289
-     * @return \string                            URL string
289
+     * @return string                            URL string
290 290
      */
291 291
     public function __toString()
292 292
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -191,8 +191,7 @@
 block discarded – undo
191 191
      */
192 192
     public function isRelative()
193 193
     {
194
-        return empty($this->_parts['path']) ? false :
195
-            (empty($this->_parts['host']) && (boolean)strncmp($this->_parts['path'], '/', 1));
194
+        return empty($this->_parts['path']) ? false : (empty($this->_parts['host']) && (boolean)strncmp($this->_parts['path'], '/', 1));
196 195
     }
197 196
 
198 197
     /**
Please login to merge, or discard this patch.