original_string: public static function set(array &$array, ...$keys): void
      {
          if (\count($keys) < 2) {
              throw new \InvalidArgumentException('Method `Collection::set()` is required minimum one key and value');
          }
  
          $value = array_pop($keys);
          while (\count($keys) > 1) {
              $key = array_shift($keys);
              if (!isset($array[$key]) || !\is_array($array[$key])) {
                  $array[$key] = [];
              }
              $array = &$array[$key];
          }
          $array[array_shift($keys)] = $value;
      }
code: public static function set(array &$array, ...$keys): void
      {
          if (\count($keys) < 2) {
              throw new \InvalidArgumentException('Method `Collection::set()` is required minimum one key and value');
          }
  
          $value = array_pop($keys);
          while (\count($keys) > 1) {
              $key = array_shift($keys);
              if (!isset($array[$key]) || !\is_array($array[$key])) {
                  $array[$key] = [];
              }
              $array = &$array[$key];
          }
          $array[array_shift($keys)] = $value;
      }
code_tokens: public static function set ( array & $ array , ... $ keys ) : void { if ( \ count ( $ keys ) < 2 ) { throw new \ InvalidArgumentException ( 'Method `Collection::set()` is required minimum one key and value' ) ; } $ value = array_pop ( $ keys ) ; while ( \ count ( $ keys ) > 1 ) { $ key = array_shift ( $ keys ) ; if ( ! isset ( $ array [ $ key ] ) || ! \ is_array ( $ array [ $ key ] ) ) { $ array [ $ key ] = [ ] ; } $ array = & $ array [ $ key ] ; } $ array [ array_shift ( $ keys ) ] = $ value ; }
docstring: Set an element of array by key and sub-keys
  
  @param array $array
  @param array ...$keys
  
  @return void
  @throws \InvalidArgumentException
docstring_tokens: Set an element of array by key and sub - keys