Code Duplication    Length = 16-17 lines in 2 locations

src/Stringy.php 2 locations

@@ 2206-2221 (lines=16) @@
2203
   *
2204
   * @return Stringy
2205
   */
2206
  public function afterFirst($separator)
2207
  {
2208
    if (($offset = $this->indexOf($separator)) === false) {
2209
      return static::create('');
2210
    }
2211
2212
    return static::create(
2213
        UTF8::substr(
2214
            $this->str,
2215
            $offset + UTF8::strlen($separator, $this->encoding),
2216
            null,
2217
            $this->encoding
2218
        ),
2219
        $this->encoding
2220
    );
2221
  }
2222
2223
  /**
2224
   * Gets the substring after the last occurrence of a separator.
@@ 2231-2247 (lines=17) @@
2228
   *
2229
   * @return Stringy
2230
   */
2231
  public function afterLast($separator)
2232
  {
2233
    $offset = $this->indexOfLast($separator);
2234
    if ($offset === false) {
2235
      return static::create('');
2236
    }
2237
2238
    return static::create(
2239
        UTF8::substr(
2240
            $this->str,
2241
            $offset + UTF8::strlen($separator, $this->encoding),
2242
            null,
2243
            $this->encoding
2244
        ),
2245
        $this->encoding
2246
    );
2247
  }
2248
2249
  /**
2250
   * Gets the substring before the first occurrence of a separator.