code: public static function char($data)
      {
          self::$data = $data;
          self::$data = preg_replace("/[^a-zA-ZА-Яа-я0-9\s]/u", " ", self::$data);
          self::$data = preg_replace('/[\s]{2,}/u', "-", self::$data);
          self::$data = preg_replace("/[\s+]/u", "-", self::$data);
          return self::$data;
      }
docs: Чистим строки
  @param $data
  @return null|string|string[]