You are here

public static function WebformObjectHelper::sortByProperty in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Utility/WebformObjectHelper.php \Drupal\webform\Utility\WebformObjectHelper::sortByProperty()

Sort object by properties.

Parameters

object $object: An object.

Return value

object Object sorted by properties.

2 calls to WebformObjectHelper::sortByProperty()
WebformCliService::drush_webform_composer_set_libraries in src/Commands/WebformCliService.php
Set composer libraries.
WebformObjectHelperTest::testSortByProperty in tests/src/Unit/Utility/WebformObjectHelperTest.php
Tests sorting object by properties.

File

src/Utility/WebformObjectHelper.php, line 19

Class

WebformObjectHelper
Provides helper to operate on objects.

Namespace

Drupal\webform\Utility

Code

public static function sortByProperty($object) {
  $array = (array) $object;
  ksort($array);
  return (object) $array;
}