Passed
Branch tests1.5 (b5e513)
by Wanderson
01:14
created

Keywords::otimize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Win\Html\Seo;
4
5
use Win\Format\Str;
6
7
/**
8
 * Auxilia gerenciamento de Keywords
9
 */
10
class Keywords {
11
12
	public static $DEFAULT = [];
13
14
	/**
15
	 * Retorna uma string em minúscula, separada por virgula
16
	 * @param string[] $keys
17
	 * @return string
18
	 */
19
	public static function otimize($keys, $maxLength = 100) {
20
		return Str::lower(str_replace([',...', '...'], '', Str::truncate(implode(', ', array_filter(array_merge($keys, static::$DEFAULT))), $maxLength)));
21
	}
22
23
}
24