original_string: public static function toObject($array, $class = \stdClass::class)
      {
          $object = new $class;
  
          foreach ($array as $name => $value) {
              $name = trim($name);
  
              if (!$name || is_numeric($name)) {
                  continue;
              }
  
              $object->$name = \is_array($value) ? self::toObject($value) : $value;
          }
  
          return $object;
      }
code: public static function toObject($array, $class = \stdClass::class)
      {
          $object = new $class;
  
          foreach ($array as $name => $value) {
              $name = trim($name);
  
              if (!$name || is_numeric($name)) {
                  continue;
              }
  
              $object->$name = \is_array($value) ? self::toObject($value) : $value;
          }
  
          return $object;
      }
code_tokens: public static function toObject ( $ array , $ class = \ stdClass :: class ) { $ object = new $ class ; foreach ( $ array as $ name => $ value ) { $ name = trim ( $ name ) ; if ( ! $ name || is_numeric ( $ name ) ) { continue ; } $ object -> $ name = \ is_array ( $ value ) ? self :: toObject ( $ value ) : $ value ; } return $ object ; }
docstring: data to array
  @param array|\Traversable $array
  @param string $class
  @return mixed
docstring_tokens: data to array