static public function fromArray(array $array)
    {
        $name      = $array['name'];
        $value     = $array['value'];
        $path      = isset($array['path']) ? $array['path'] : null;
        $domain    = isset($array['domain']) ? $array['domain'] : null;
        $isSecure  = isset($array['secure']) ? $array['secure'] : null;
        $expiry    = isset($array['expiry']) ? \DateTime::createFromFormat('U', $array['expiry']) : null;

        if (false === $expiry) {
            throw new \InvalidArgumentException(sprintf('Unable to parse cookie expiry: "%s".', $array['expiry']));
        }

        return new self($name, $value, $path, $domain, $isSecure, $expiry);
    }