src/Model/Behavior/SlugBehavior.php
public function slug($entity, $string = null, $separator = null)
    {
        if ($separator === null) {
            $separator = $this->getConfig('separator');
        }

        if (is_string($entity)) {
            if ($string !== null) {
                $separator = $string;
            }
            $string = $entity;
            unset($entity);
        } elseif (($entity instanceof Entity) && $string === null) {
            $string = $this->_getSlugStringFromEntity($entity, $separator);
        }

        $slug = $this->_slug($string, $separator);

        $unique = $this->getConfig('unique');
        if (isset($entity) && $unique) {
            $slug = $unique($entity, $slug, $separator);
        }

        return $slug;
    }
public function slug($entity, $string = null, $separator = null)
    {
        if ($separator === null) {
            $separator = $this->getConfig('separator');
        }

        if (is_string($entity)) {
            if ($string !== null) {
                $separator = $string;
            }
            $string = $entity;
            unset($entity);
        } elseif (($entity instanceof Entity) && $string === null) {
            $string = $this->_getSlugStringFromEntity($entity, $separator);
        }

        $slug = $this->_slug($string, $separator);

        $unique = $this->getConfig('unique');
        if (isset($entity) && $unique) {
            $slug = $unique($entity, $slug, $separator);
        }

        return $slug;
    }
public function slug ( $ entity , $ string = null , $ separator = null ) { if ( $ separator === null ) { $ separator = $ this -> getConfig ( 'separator' ) ; } if ( is_string ( $ entity ) ) { if ( $ string !== null ) { $ separator = $ string ; } $ string = $ entity ; unset ( $ entity ) ; } elseif ( ( $ entity instanceof Entity ) && $ string === null ) { $ string = $ this -> _getSlugStringFromEntity ( $ entity , $ separator ) ; } $ slug = $ this -> _slug ( $ string , $ separator ) ; $ unique = $ this -> getConfig ( 'unique' ) ; if ( isset ( $ entity ) && $ unique ) { $ slug = $ unique ( $ entity , $ slug , $ separator ) ; } return $ slug ; }
Generates slug.

@param \Cake\ORM\Entity|string $entity Entity to create slug for
@param string $string String to create slug for.
@param string|null $separator Separator.
@return string Slug.
Generates slug .