Integer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A minLength() 0 3 1
A formatId() 0 3 1
1
<?php
2
3
namespace Win\Common\Utils;
4
/**
5
 * Manipulador de Inteiros
6
 */
7
class Integer
8
{
9
	/**
10
	 * Retorna o inteiro com a quantidade de caracteres escolhido
11
	 * Formatando com zeros à esquerda se necessário
12
	 * @param int $int
13
	 * @param int $length
14
	 * @return string
15
	 */
16
	public static function minLength($int = 0, $length = 2)
17
	{
18
		return str_pad($int, $length, '0', STR_PAD_LEFT);
19
	}
20
21
	/**
22
	 * Retorna o Id com no mínimo 6 dígitos
23
	 * @param int $id
24
	 * @return string
25
	 */
26
	public static function formatId($id)
27
	{
28
		return str_pad($id, 6, '0', STR_PAD_LEFT);
29
	}
30
}
31