basic async-interop support; generator consumer missing
[m6w6/seekat] / lib / API / Links.php
index 85d24bd2afe441d5d70ea7071029e0060f170973..322eb8e847115557cacbf33e799a442da71470fa 100644 (file)
@@ -31,11 +31,13 @@ final class Links implements Serializable
         * @param Header $links The Link header
         * @throws UnexpectedValueException
         */
-       function __construct(Header $links) {
-               if (strcasecmp($links->name, "Link")) {
-                       throw new UnexpectedValueException("Expected 'Link' header, got: '{$links->name}'");
+       function __construct(Header $links = null) {
+               if ($links) {
+                       if (strcasecmp($links->name, "Link")) {
+                               throw new UnexpectedValueException("Expected 'Link' header, got: '{$links->name}'");
+                       }
+                       $this->unserialize($links->value);
                }
-               $this->unserialize($links->value);
        }
 
        /**