Code Duplication    Length = 12-14 lines in 2 locations

src/KeyTags.php 1 location

@@ 48-61 (lines=14) @@
45
        return isset($this->tags[$this->position]);
46
    }
47
48
    public function offsetSet($offset, $value)
49
    {
50
        if (!is_object($value) || !$value instanceof Tag\KeyTag) {
51
            throw new \InvalidArgumentException('Expected $value of class Chrisyue\PhpM3u8\Tag\KeyTag');
52
        }
53
54
        if (is_null($offset)) {
55
            $this->add($value);
56
57
            return;
58
        }
59
60
        $this->tags[$offset] = $value;
61
    }
62
63
    /**
64
     * @return Chrisyue\PhpM3u8\Tag\KeyTag

src/Segments.php 1 location

@@ 52-63 (lines=12) @@
49
        return isset($this->segments[$this->position]);
50
    }
51
52
    public function offsetSet($offset, $value)
53
    {
54
        if (!is_object($value) || !$value instanceof Segment) {
55
            throw new \InvalidArgumentException('Expected $value of class Chrisyue\PhpM3u8\Segment');
56
        }
57
        if (is_null($offset)) {
58
            $this->add($value);
59
60
            return;
61
        }
62
        $this->segments[$offset] = $value;
63
    }
64
65
    /**
66
     * @return Chrisyue\PhpM3u8\Segment