public static function machineName($string, $pattern = '/[^a-zA-Z0-9\-]/')
    {
        if (!is_string($string)) {
            throw new \InvalidArgumentException(
                'A non string argument has been given.'
            );
        }
        $string = strtr($string, ' ', '-');

        return strtolower(self::cleanString($string, $pattern));
    }
public static function machineName($string, $pattern = '/[^a-zA-Z0-9\-]/')
    {
        if (!is_string($string)) {
            throw new \InvalidArgumentException(
                'A non string argument has been given.'
            );
        }
        $string = strtr($string, ' ', '-');

        return strtolower(self::cleanString($string, $pattern));
    }
public static function machineName ( $ string , $ pattern = '/[^a-zA-Z0-9\-]/' ) { if ( ! is_string ( $ string ) ) { throw new \ InvalidArgumentException ( 'A non string argument has been given.' ) ; } $ string = strtr ( $ string , ' ' , '-' ) ; return strtolower ( self :: cleanString ( $ string , $ pattern ) ) ; }
Machine name from string.

@param string $string
The machine name input.

@param string $pattern
The pattern on which characters are allowed.

@return string
The formatted machine name.
Machine name from string .