Code Duplication    Length = 12-14 lines in 2 locations

Provider/SoundCloudProvider.php 1 location

@@ 81-94 (lines=14) @@
78
     * @return mixed
79
     * @throws \Exception
80
     */
81
    protected function getDataByReference($reference)
82
    {
83
        $this->disableErrorHandler();
84
        $data = json_decode(file_get_contents(sprintf(self::URL_OEMBED, $reference)), true);
85
        $this->restoreErrorHandler();
86
87
        if (empty($data['title'])) {
88
            throw new \Exception(
89
                sprintf('Could not get data from SoundCloud for id "%s", is the name correct?', $reference)
90
            );
91
        }
92
93
        return $data;
94
    }
95
96
    /**
97
     * @param $value

Provider/YouTubeProvider.php 1 location

@@ 112-123 (lines=12) @@
109
     * @return mixed
110
     * @throws \Exception
111
     */
112
    protected function getDataByYouTubeId($id)
113
    {
114
        $this->disableErrorHandler();
115
        $data = json_decode(file_get_contents(sprintf(self::URL_OEMBED, $id)), true);
116
        $this->restoreErrorHandler();
117
118
        if (empty($data['title'])) {
119
            throw new \Exception(sprintf('YouTube ID "%s" seems to be incorrect', $id));
120
        }
121
122
        return $data;
123
    }
124
125
    /**
126
     * @param $value