Skip to content

Commit

Permalink
str_slug_force added. str_snake_case_safe renamed to `str_snake_c…
Browse files Browse the repository at this point in the history
…ase_force`
  • Loading branch information
yahyaerturan authored Mar 5, 2020
1 parent d615a89 commit 46b4a40
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* str_camel_case($value)
* str_studly_case($value)
* str_slug($title, $separator = '-')
* str_snake_case_safe($title, $separator = '_')
* str_snake_case_force($title, $separator = '_')
* str_slug_force($title, $separator = '-')
* str_json($str = '/', $returnDecoded = true, $asArray = false)
*/

Expand Down Expand Up @@ -238,15 +239,31 @@ function str_slug($title, $separator = '-')

// ------------------------------------------------------------------------

if ( ! function_exists('str_snake_case_safe')) {
if ( ! function_exists('str_snake_case_force')) {
/**
* @inheritDoc str_slug
*
* @param string $title
* @param string $separator
* @return string
*/
function str_snake_case_safe($title, $separator = '_')
function str_snake_case_force($title, $separator = '_')
{
return str_slug(str_snake_case($title), $separator);
}
}

// ------------------------------------------------------------------------

if ( ! function_exists('str_slug_force')) {
/**
* @inheritDoc str_slug
*
* @param string $title
* @param string $separator
* @return string
*/
function str_slug_force($title, $separator = '-')
{
return str_slug(str_snake_case($title), $separator);
}
Expand Down

0 comments on commit 46b4a40

Please sign in to comment.