@@ -72,12 +72,12 @@ class Util implements Countable
72
72
* determining the type in the same way RouterOS would determine it for a
73
73
* literal.
74
74
*
75
- * This method is intended to be the very opposite of {@link escapeValue()}.
76
- * That is, results from that method, if given to this method, should
77
- * produce equivalent results.
75
+ * This method is intended to be the very opposite of
76
+ * {@link static::escapeValue()}. hat is, results from that method, if
77
+ * given to this method, should produce equivalent results.
78
78
*
79
79
* @param string $value The value to be parsed. Must be a literal of a
80
- * value, e.g. what {@link escapeValue()} will give you.
80
+ * value, e.g. what {@link static:: escapeValue()} will give you.
81
81
*
82
82
* @return mixed Depending on RouterOS type detected:
83
83
* - "nil" or "nothing" - NULL.
@@ -196,8 +196,12 @@ public static function escapeValue($value)
196
196
break ;
197
197
}
198
198
$ result = '' ;
199
- foreach ($ value as $ val ) {
200
- $ result .= '; ' . static ::escapeValue ($ val );
199
+ foreach ($ value as $ key => $ val ) {
200
+ $ result .= '; ' ;
201
+ if (!is_int ($ key )) {
202
+ $ result .= static ::escapeValue ($ key ) . '= ' ;
203
+ }
204
+ $ result .= static ::escapeValue ($ val );
201
205
}
202
206
$ value = '{ ' . substr ($ result , 1 ) . '} ' ;
203
207
break ;
@@ -332,7 +336,7 @@ public function changeMenu($newMenu = '')
332
336
* @param array $params An array of local variables to make available in
333
337
* the script. Variable names are array keys, and variable values are
334
338
* array values. Array values are automatically processed with
335
- * {@link escapeValue()}.
339
+ * {@link static:: escapeValue()}.
336
340
* Note that the script's (generated) name is always added as the
337
341
* variable "_", which you can overwrite from here.
338
342
* @param string $policy Allows you to specify a policy the script must
@@ -366,13 +370,13 @@ public function exec(
366
370
* cache may end up being out of date. By calling this method right before
367
371
* targeting an item with a number, you can ensure number accuracy.
368
372
*
369
- * Note that Util's {@link move()} and {@link remove()} methods
370
- * automatically clear the cache before returning, while {@link add()} adds
371
- * the new item's ID to the cache as the next number. A change in the menu
372
- * also clears the cache.
373
+ * Note that Util's {@link static:: move()} and {@link static:: remove()}
374
+ * methods automatically clear the cache before returning, while
375
+ * {@link static::add()} adds the new item's ID to the cache as the next
376
+ * number. A change in the menu also clears the cache.
373
377
*
374
378
* Note also that the cache is being rebuilt unconditionally every time you
375
- * use {@link find()} with a callback.
379
+ * use {@link static:: find()} with a callback.
376
380
*
377
381
* @return $this The Util object itself.
378
382
*/
@@ -527,7 +531,8 @@ public function get($number, $value_name)
527
531
*
528
532
* Zero or more arguments can be specified, each being a criteria.
529
533
* If zero arguments are specified, enables all items.
530
- * See {@link find()} for a description of what criteria are accepted.
534
+ * See {@link static::find()} for a description of what criteria are
535
+ * accepted.
531
536
*
532
537
* @return ResponseCollection returns the response collection, allowing you
533
538
* to inspect errors, if any.
@@ -542,7 +547,8 @@ public function enable()
542
547
*
543
548
* Zero or more arguments can be specified, each being a criteria.
544
549
* If zero arguments are specified, disables all items.
545
- * See {@link find()} for a description of what criteria are accepted.
550
+ * See {@link static::find()} for a description of what criteria are
551
+ * accepted.
546
552
*
547
553
* @return ResponseCollection Returns the response collection, allowing you
548
554
* to inspect errors, if any.
@@ -557,7 +563,8 @@ public function disable()
557
563
*
558
564
* Zero or more arguments can be specified, each being a criteria.
559
565
* If zero arguments are specified, removes all items.
560
- * See {@link find()} for a description of what criteria are accepted.
566
+ * See {@link static::find()} for a description of what criteria are
567
+ * accepted.
561
568
*
562
569
* @return ResponseCollection Returns the response collection, allowing you
563
570
* to inspect errors, if any.
@@ -576,7 +583,7 @@ public function remove()
576
583
* which match certain criteria.
577
584
*
578
585
* @param mixed $numbers Targeted items. Can be any criteria accepted by
579
- * {@link find()} or NULL in case the menu is one without items
586
+ * {@link static:: find()} or NULL in case the menu is one without items
580
587
* (e.g. "/system identity").
581
588
* @param array $newValues An array with the names of each property to set
582
589
* as an array key, and the new value as an array value.
@@ -597,10 +604,10 @@ public function set($numbers, array $newValues)
597
604
}
598
605
599
606
/**
600
- * Alias of {@link set()}
607
+ * Alias of {@link static:: set()}
601
608
*
602
609
* @param mixed $numbers Targeted items. Can be any criteria accepted by
603
- * {@link find()}.
610
+ * {@link static:: find()}.
604
611
* @param array $newValues An array with the names of each changed property
605
612
* as an array key, and the new value as an array value.
606
613
*
@@ -620,7 +627,7 @@ public function edit($numbers, array $newValues)
620
627
* reserved word.
621
628
*
622
629
* @param mixed $numbers Targeted items. Can be any criteria accepted
623
- * by {@link find()}.
630
+ * by {@link static:: find()}.
624
631
* @param string $value_name The name of the value you want to unset.
625
632
*
626
633
* @return ResponseCollection Returns the response collection, allowing you
@@ -681,11 +688,11 @@ public function add(array $values)
681
688
* be a move command on that menu. If in doubt, check from a terminal.
682
689
*
683
690
* @param mixed $numbers Targeted items. Can be any criteria accepted
684
- * by {@link find()}.
691
+ * by {@link static:: find()}.
685
692
* @param mixed $destination item before which the targeted items will be
686
- * moved to. Can be any criteria accepted by {@link find()}. If multiple
687
- * items match the criteria, the targeted items will move above the
688
- * first match.
693
+ * moved to. Can be any criteria accepted by {@link static:: find()}.
694
+ * If multiple items match the criteria, the targeted items will move
695
+ * above the first match.
689
696
*
690
697
* @return ResponseCollection Returns the response collection, allowing you
691
698
* to inspect errors, if any.
@@ -708,8 +715,8 @@ public function move($numbers, $destination)
708
715
*
709
716
* Counts items at the current menu. This executes a dedicated command
710
717
* ("print" with a "count-only" argument) on RouterOS, which is why only
711
- * queries are allowed as a criteria, in contrast with {@link find()},
712
- * where numbers and callbacks are allowed also.
718
+ * queries are allowed as a criteria, in contrast with
719
+ * {@link static::find()}, where numbers and callbacks are allowed also.
713
720
*
714
721
* @param Query $query A query to filter items by. Without it, all items
715
722
* are included in the count.
@@ -849,7 +856,8 @@ public function fileGetContents($filename, $tmpScriptName = null)
849
856
* @param string $what What action to perform.
850
857
* @param array $args Zero or more arguments can be specified, each being
851
858
* a criteria. If zero arguments are specified, removes all items.
852
- * See {@link find()} for a description of what criteria are accepted.
859
+ * See {@link static::find()} for a description of what criteria are
860
+ * accepted.
853
861
*
854
862
* @return ResponseCollection Returns the response collection, allowing you
855
863
* to inspect errors, if any.
0 commit comments