1 | <?php |
||
5 | class Configuration |
||
6 | { |
||
7 | |||
8 | const DEFAULT_PATTERN = 'a-zA-Z0-9~*-*'; |
||
9 | |||
10 | const LOWER = "abcdefghijklmnopqrstuvwxyz"; |
||
11 | |||
12 | const UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
||
13 | |||
14 | const NUMBERS = "0123456789"; |
||
15 | |||
16 | const SYMBOLS = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'; |
||
17 | |||
18 | public $seed = null; |
||
19 | |||
20 | public $pattern = null; |
||
21 | |||
22 | public $primaryColor = null; |
||
23 | |||
24 | public $secondaryColor = null; |
||
25 | |||
26 | public $text = null; |
||
27 | |||
28 | public $keys = null; |
||
29 | |||
30 | public function __construct($seed, $pattern, $keys, $spaceBarSize, $text, $primaryColor, $secondaryColor) |
||
40 | |||
41 | public function getPatternCharacters() |
||
45 | |||
46 | public static function completePattern($pattern) |
||
54 | |||
55 | /** |
||
56 | * If no (numeric) seed is provided, generate one. |
||
57 | */ |
||
58 | public static function evalSeed($seed) |
||
66 | |||
67 | /** |
||
68 | * If no pattern is provided, return the default. |
||
69 | */ |
||
70 | public static function evalPattern($pattern) |
||
77 | |||
78 | /** |
||
79 | * If no keys are provided, use qwerty. |
||
80 | */ |
||
81 | public static function evalKeys($keys) |
||
90 | } |
||
91 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: