Code Duplication    Length = 16-17 lines in 3 locations

src/Stringy.php 3 locations

@@ 2311-2326 (lines=16) @@
2308
   *
2309
   * @return static 
2310
   */
2311
  public function afterFirst($separator)
2312
  {
2313
    if (($offset = $this->indexOf($separator)) === false) {
2314
      return static::create('');
2315
    }
2316
2317
    return static::create(
2318
        UTF8::substr(
2319
            $this->str,
2320
            $offset + UTF8::strlen($separator, $this->encoding),
2321
            null,
2322
            $this->encoding
2323
        ),
2324
        $this->encoding
2325
    );
2326
  }
2327
2328
  /**
2329
   * Gets the substring after the last occurrence of a separator.
@@ 2362-2378 (lines=17) @@
2359
   *
2360
   * @return static 
2361
   */
2362
  public function beforeFirst($separator)
2363
  {
2364
    $offset = $this->indexOf($separator);
2365
    if ($offset === false) {
2366
      return static::create('', $this->encoding);
2367
    }
2368
2369
    return static::create(
2370
        UTF8::substr(
2371
            $this->str,
2372
            0,
2373
            $offset,
2374
            $this->encoding
2375
        ),
2376
        $this->encoding
2377
    );
2378
  }
2379
2380
  /**
2381
   * Gets the substring before the last occurrence of a separator.
@@ 2388-2404 (lines=17) @@
2385
   *
2386
   * @return static 
2387
   */
2388
  public function beforeLast($separator)
2389
  {
2390
    $offset = $this->indexOfLast($separator);
2391
    if ($offset === false) {
2392
      return static::create('', $this->encoding);
2393
    }
2394
2395
    return static::create(
2396
        UTF8::substr(
2397
            $this->str,
2398
            0,
2399
            $offset,
2400
            $this->encoding
2401
        ),
2402
        $this->encoding
2403
    );
2404
  }
2405
2406
  /**
2407
   * Returns the string with the first letter of each word capitalized,