1 | <?php |
||
31 | class OrderBy |
||
32 | { |
||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $preSeparator = ''; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $separator = ', '; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $postSeparator = ''; |
||
47 | |||
48 | /** |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $allowedClasses = []; |
||
52 | |||
53 | /** |
||
54 | * @var array |
||
55 | */ |
||
56 | protected $parts = []; |
||
57 | |||
58 | /** |
||
59 | * @param string|null $sort |
||
60 | * @param string|null $order |
||
61 | */ |
||
62 | 16 | public function __construct($sort = null, $order = null) |
|
68 | |||
69 | /** |
||
70 | * @param string $sort |
||
71 | * @param string|null $order |
||
72 | * |
||
73 | * @return void |
||
74 | */ |
||
75 | 16 | public function add($sort, $order = null) |
|
80 | |||
81 | /** |
||
82 | * @return integer |
||
83 | */ |
||
84 | 1 | public function count() |
|
88 | |||
89 | /** |
||
90 | * @return array |
||
91 | */ |
||
92 | 1 | public function getParts() |
|
96 | |||
97 | /** |
||
98 | * @return string |
||
99 | */ |
||
100 | 12 | public function __toString() |
|
104 | } |
||
105 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: