@@ -62,8 +62,12 @@ public function process(array $data): array
6262 * @param string[] $wheres
6363 * @return string
6464 */
65- public function sqlBuilder (string $ table , string $ primaryCol = 'name ' , string $ parentCol = 'parent_id ' , array $ wheres = []): string
66- {
65+ public function sqlBuilder (
66+ string $ table ,
67+ string $ primaryCol = 'name ' ,
68+ string $ parentCol = 'parent_id ' ,
69+ array $ wheres = []
70+ ): string {
6771 return 'SELECT `id`, ` ' . $ primaryCol . '`, ` ' . $ parentCol . '` '
6872 . 'FROM ` ' . $ table . '` '
6973 . ($ wheres !== [] ? 'WHERE ( ' . implode (') AND ( ' , $ wheres ) . ') ' : '' )
@@ -108,7 +112,11 @@ private function serializeCategoriesToSelectbox(?array $categories, int $level =
108112
109113 $ return = [];
110114 foreach ($ categories as $ catKey => $ category ) {
111- if (array_key_exists ('id ' , $ category ) === false || array_key_exists ('parent ' , $ category ) === false || array_key_exists ('name ' , $ category ) === false ) {
115+ if (
116+ array_key_exists ('id ' , $ category ) === false
117+ || array_key_exists ('parent ' , $ category ) === false
118+ || array_key_exists ('name ' , $ category ) === false
119+ ) {
112120 throw new \InvalidArgumentException ('Category " ' . $ catKey . '" must contain keys "id", "parent" and "name". ' );
113121 }
114122 if ($ category ['parent ' ] === $ parent ) {
0 commit comments