Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Composite.php
Go to the documentation of this file.
1 <?php
8 
12 class Composite
13 {
25  public function filterAndSortDeclaredComponents($declaredComponents)
26  {
28  $declaredComponents = array_filter(
29  $declaredComponents,
30  function ($component) {
31  return (isset($component['type']) && isset($component['sortOrder']));
32  }
33  );
35  uasort(
36  $declaredComponents,
37  function ($firstComponent, $secondComponent) {
38  return (int)$firstComponent['sortOrder'] <=> (int)$secondComponent['sortOrder'];
39  }
40  );
41  $declaredComponents = array_values($declaredComponents);
42  return $declaredComponents;
43  }
44 }
filterAndSortDeclaredComponents($declaredComponents)
Definition: Composite.php:25