1 | <?php |
||
10 | class WidthCollection |
||
11 | { |
||
12 | /** |
||
13 | * Array containing character widths for each font & size. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | private static $widths = array(); |
||
18 | |||
19 | /** |
||
20 | * Create character width map for each font. |
||
21 | */ |
||
22 | 6 | public function __construct() |
|
27 | |||
28 | /** |
||
29 | * Dirty way to allow developers to load character widths that |
||
30 | * are not yet included. |
||
31 | * |
||
32 | * @param string $csvPath |
||
33 | */ |
||
34 | 6 | public static function loadWidthsFromCsv($csvPath) |
|
48 | |||
49 | // Testing additional character widths ... fixed types. |
||
50 | // private static function loadAdditionalWidths() |
||
51 | // { |
||
52 | // $hiragana = array('ぁ','あ','ぃ','い','ぅ','う','ぇ','え','ぉ','お','か','が','き','ぎ','く','ぐ','け','げ','こ','ご','さ','ざ','し','じ','す','ず','せ','ぜ','そ','ぞ','た','だ','ち','ぢ','っ','つ','づ','て','で','と','ど','な','に','ぬ','ね','の','は','ば','ぱ','ひ','び','ぴ','ふ','ぶ','ぷ','へ','べ','ぺ','ほ','ぼ','ぽ','ま','み','む','め','も','ゃ','や','ゅ','ゆ','ょ','よ','ら','り','る','れ','ろ','ゎ','わ','ゐ','ゑ','を','ん','ゔ','ゕ','ゖ'); |
||
53 | // foreach (self::$widths as &$width) { |
||
54 | // $width[9] += array_combine($hiragana, array_fill(0, count($hiragana), 1.76)); |
||
55 | // $width[10] += array_combine($hiragana, array_fill(0, count($hiragana), 2.06)); |
||
56 | // $width[11] += array_combine($hiragana, array_fill(0, count($hiragana), 2.35)); |
||
57 | // $width[12] += array_combine($hiragana, array_fill(0, count($hiragana), 2.35)); |
||
58 | // $width[13] += array_combine($hiragana, array_fill(0, count($hiragana), 2.65)); |
||
59 | // $width[14] += array_combine($hiragana, array_fill(0, count($hiragana), 2.94)); |
||
60 | // $width[15] += array_combine($hiragana, array_fill(0, count($hiragana), 2.94)); |
||
61 | // } |
||
62 | // } |
||
63 | |||
64 | /** |
||
65 | * Return character widths for given font name. |
||
66 | * |
||
67 | * @param string $fontName |
||
68 | * @param int $fontSize |
||
69 | * @return array |
||
70 | */ |
||
71 | 4 | public function get($fontName, $fontSize) |
|
81 | } |
||
82 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.