Code Duplication    Length = 17-17 lines in 2 locations

src/Stringy.php 2 locations

@@ 2257-2273 (lines=17) @@
2254
   *
2255
   * @return Stringy
2256
   */
2257
  public function beforeFirst($separator)
2258
  {
2259
    $offset = $this->indexOf($separator);
2260
    if ($offset === false) {
2261
      return static::create('');
2262
    }
2263
2264
    return static::create(
2265
        UTF8::substr(
2266
            $this->str,
2267
            0,
2268
            $offset,
2269
            $this->encoding
2270
        ),
2271
        $this->encoding
2272
    );
2273
  }
2274
2275
  /**
2276
   * Gets the substring before the last occurrence of a separator.
@@ 2283-2299 (lines=17) @@
2280
   *
2281
   * @return Stringy
2282
   */
2283
  public function beforeLast($separator)
2284
  {
2285
    $offset = $this->indexOfLast($separator);
2286
    if ($offset === false) {
2287
      return static::create('');
2288
    }
2289
2290
    return static::create(
2291
        UTF8::substr(
2292
            $this->str,
2293
            0,
2294
            $offset,
2295
            $this->encoding
2296
        ),
2297
        $this->encoding
2298
    );
2299
  }
2300
}
2301