original_string: public static function set(array $array, ...$args): array
      {
          if (empty($args)) {
              throw new \ArgumentCountError('Too few arguments to function xobotyi\A::set(), 1 passed, at least 2 expected');
          }
  
          if (is_string($args[0]) || is_numeric($args[0])) {
              if (!isset($args[1]) && !\array_key_exists(1, $args)) {
                  throw new \ArgumentCountError('Too few arguments to function xobotyi\A::set(), 2 passed, at least 3 expected when second is string');
              }
  
              $args = [$args[0] => $args[1]];
          } else if (\is_array($args[0])) {
              $args = $args[0];
          } else {
              throw new \TypeError("Argument 2 passed to xobotyi\A::set() must be of the type array or string, " . gettype($args[0]) . " given");
          }
  
          foreach ($args as $path => &$value) {
              if ($path === '') {
                  continue;
              }
  
              $path = self::splitPath($path);
  
              if (empty($path)) {
                  continue;
              }
  
              $scope = &$array;
  
              for ($i = 0; $i < count($path) - 1; $i++) {
                  if (!isset($scope[$path[$i]]) || !\is_array($scope[$path[$i]])) {
                      $scope[$path[$i]] = [];
                  }
  
                  $scope = &$scope[$path[$i]];
              }
  
              $scope[$path[$i]] = $value;
          }
  
          return $array;
      }
code: public static function set(array $array, ...$args): array
      {
          if (empty($args)) {
              throw new \ArgumentCountError('Too few arguments to function xobotyi\A::set(), 1 passed, at least 2 expected');
          }
  
          if (is_string($args[0]) || is_numeric($args[0])) {
              if (!isset($args[1]) && !\array_key_exists(1, $args)) {
                  throw new \ArgumentCountError('Too few arguments to function xobotyi\A::set(), 2 passed, at least 3 expected when second is string');
              }
  
              $args = [$args[0] => $args[1]];
          } else if (\is_array($args[0])) {
              $args = $args[0];
          } else {
              throw new \TypeError("Argument 2 passed to xobotyi\A::set() must be of the type array or string, " . gettype($args[0]) . " given");
          }
  
          foreach ($args as $path => &$value) {
              if ($path === '') {
                  continue;
              }
  
              $path = self::splitPath($path);
  
              if (empty($path)) {
                  continue;
              }
  
              $scope = &$array;
  
              for ($i = 0; $i < count($path) - 1; $i++) {
                  if (!isset($scope[$path[$i]]) || !\is_array($scope[$path[$i]])) {
                      $scope[$path[$i]] = [];
                  }
  
                  $scope = &$scope[$path[$i]];
              }
  
              $scope[$path[$i]] = $value;
          }
  
          return $array;
      }
code_tokens: public static function set ( array $ array , ... $ args ) : array { if ( empty ( $ args ) ) { throw new \ ArgumentCountError ( 'Too few arguments to function xobotyi\A::set(), 1 passed, at least 2 expected' ) ; } if ( is_string ( $ args [ 0 ] ) || is_numeric ( $ args [ 0 ] ) ) { if ( ! isset ( $ args [ 1 ] ) && ! \ array_key_exists ( 1 , $ args ) ) { throw new \ ArgumentCountError ( 'Too few arguments to function xobotyi\A::set(), 2 passed, at least 3 expected when second is string' ) ; } $ args = [ $ args [ 0 ] => $ args [ 1 ] ] ; } else if ( \ is_array ( $ args [ 0 ] ) ) { $ args = $ args [ 0 ] ; } else { throw new \ TypeError ( "Argument 2 passed to xobotyi\A::set() must be of the type array or string, " . gettype ( $ args [ 0 ] ) . " given" ) ; } foreach ( $ args as $ path => & $ value ) { if ( $ path === '' ) { continue ; } $ path = self :: splitPath ( $ path ) ; if ( empty ( $ path ) ) { continue ; } $ scope = & $ array ; for ( $ i = 0 ; $ i < count ( $ path ) - 1 ; $ i ++ ) { if ( ! isset ( $ scope [ $ path [ $ i ] ] ) || ! \ is_array ( $ scope [ $ path [ $ i ] ] ) ) { $ scope [ $ path [ $ i ] ] = [ ] ; } $ scope = & $ scope [ $ path [ $ i ] ] ; } $ scope [ $ path [ $ i ] ] = $ value ; } return $ array ; }
docstring: Set the value passed with 3'rd argument on the path passed with 2'nd argument.
  If 2'nd argument is array, it's keys will be used as paths and items as values.
  Empty paths will be processed as non-existent.
  
  @param array $array
  @param array ...$args
  
  @return array
  @throws \ArgumentCountError
  @throws \TypeError
docstring_tokens: Set the value passed with 3 rd argument on the path passed with 2 nd argument . If 2 nd argument is array it s keys will be used as paths and items as values . Empty paths will be processed as non - existent .