Code Duplication    Length = 16-17 lines in 2 locations

src/Stringy.php 2 locations

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