Code Duplication    Length = 13-13 lines in 2 locations

src/Sunlight.php 1 location

@@ 67-79 (lines=13) @@
64
     *
65
     * @return object          if key is string and value is null, return options[key] value
66
     */
67
    public function option($key, $value = null)
68
    {
69
        if (is_array($key)) {
70
            $this->options = array_merge($this->options, $key);
71
            return;
72
        }
73
74
        if (null === $value) {
75
            return $this->options[$key] ? $this->options[$key] : null;
76
        }
77
78
        $this->options[$key] = $value;
79
    }
80
81
    /**
82
     * Get an API instance

src/api/BaseAPI.php 1 location

@@ 54-66 (lines=13) @@
51
     *
52
     * @return object          if key is string and value is null, return options[key] value
53
     */
54
    public function option($key, $value = null)
55
    {
56
        if (is_array($key)) {
57
            $this->options = array_merge($this->options, $key);
58
            return;
59
        }
60
61
        if (null === $value) {
62
            return $this->options[$key] ?? null;
63
        }
64
65
        $this->options[$key] = $value;
66
    }
67
68
    /**
69
     * Submit asynchronous get request