Please change "if (count($arrayPatch))" to "if ($arrayPatch) {"