Exemplo n.º 1
0
 /**
  * Truncates a string to the number of words specified.
  *
  * @param string $value
  * @param array $params params:
  *
  * - length: count of output characters.
  *
  * @return string
  */
 public static function truncateWords($value, array $params)
 {
     if (empty($params['length']) || !is_numeric($params['length'])) {
         $params['length'] = 100;
     }
     return StringHelper::truncateWords($value, (int) $params['length']);
 }
Exemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function sanitize($input)
 {
     return \rock\helpers\StringHelper::truncateWords($input, $this->length, $this->suffix);
 }