Skip to content

Latest commit

 

History

History
99 lines (59 loc) · 1.77 KB

Regex.md

File metadata and controls

99 lines (59 loc) · 1.77 KB

Meritoo Common Library

Common and useful classes, methods, exceptions etc.

Regex

Useful methods related to regular expressions

Class: Meritoo\Common\Utilities\Regex File: src/Utilities/Regex.php

createSlug($value)

Returns slug for given value

Arguments
  • string $value - Value that should be transformed to slug
Examples
  • value: non-scalar or null
  • result: false
  • value: "" (an empty string)
  • result: "" (an empty string)
  • value: "Lorem ipsum. Dolor sit 12.34 amet."
  • result: "lorem-ipsum-dolor-sit-1234-amet"

clearBeginningSlash(string): string

Clears, removes slash from the beginning of given string

Arguments
  • string $string - String that may contains slash as the 1st character
Examples
  • string: "lorem ipsum"
  • result: "lorem ipsum"
  • string: "/lorem ipsum"
  • result: "lorem ipsum"
  • string: "/ lorem 123 ipsum"
  • result: " lorem 123 ipsum"

clearEndingSlash(string): string

Clears, removes slash from the end of given string

Arguments
  • string $string - String that may contains slash as the last character
Examples
  • string: "lorem ipsum"
  • result: "lorem ipsum"
  • string: "lorem ipsum/"
  • result: "lorem ipsum"
  • string: "lorem 123 ipsum /"
  • result: "lorem 123 ipsum "

More

  1. Base test case (with common methods and data providers)
  2. Collection of elements
  3. Templates
  4. Exceptions
  5. Static methods
    1. Arrays
    2. Regex
    3. Uri
  6. Value Objects

‹ Back to Readme