Code Duplication    Length = 16-17 lines in 2 locations

src/Str/Str.php 2 locations

@@ 130-146 (lines=17) @@
127
     * @param $phrase string|[string]
128
     * @return array
129
     */
130
    static public function getBefore($string, $phrase)
131
    {
132
133
        if (!is_array($phrase)) {
134
            $phrase = [$phrase];
135
        }
136
137
        $output = [];
138
        foreach ($phrase as $item) {
139
            $e = explode($item, $string);
140
            array_pop($e);//remove the rest of string entry
141
            $output[$item] = $e;
142
        }
143
144
        return $output;
145
146
    }
147
148
    /**
149
     * Get part of a string after a phrase or array of phrases. Returns an array of results keyed by phrase
@@ 156-171 (lines=16) @@
153
     * @param $phrase string|[string]
154
     * @return array
155
     */
156
    static public function getAfter($string, $phrase)
157
    {
158
159
        if (!is_array($phrase)) {
160
            $phrase = [$phrase];
161
        }
162
163
        $output = [];
164
        foreach ($phrase as $item) {
165
            $e = explode($item, $string);
166
            array_shift($e);//remove the first item always
167
            $output[$item] = $e;
168
        }
169
170
        return $output;
171
    }
172
173
}