public function getMainComponents() {
    $identifier = self::COMPONENT_PREFIX;

    $filter = function (Extension $module) use ($identifier) {
      // Assumes that:
      // 1. Lightning sub-components are always in a sub-directory within the
      //    main component.
      // 2. The main component's directory starts with "lightning_".
      // E.g.: "/lightning_core/modules/lightning_search".
      $path = explode(DIRECTORY_SEPARATOR, $module->getPath());
      $parent = $path[count($path)-3];
      return strpos($parent, $identifier) !== 0;
    };

    return array_filter($this->getAll(), $filter);
  }
public function getMainComponents() {
    $identifier = self::COMPONENT_PREFIX;

    $filter = function (Extension $module) use ($identifier) {
      // Assumes that:
      // 1. Lightning sub-components are always in a sub-directory within the
      //    main component.
      // 2. The main component's directory starts with "lightning_".
      // E.g.: "/lightning_core/modules/lightning_search".
      $path = explode(DIRECTORY_SEPARATOR, $module->getPath());
      $parent = $path[count($path)-3];
      return strpos($parent, $identifier) !== 0;
    };

    return array_filter($this->getAll(), $filter);
  }
public function getMainComponents ( ) { $ identifier = self :: COMPONENT_PREFIX ; $ filter = function ( Extension $ module ) use ( $ identifier ) { // Assumes that: // 1. Lightning sub-components are always in a sub-directory within the //    main component. // 2. The main component's directory starts with "lightning_". // E.g.: "/lightning_core/modules/lightning_search". $ path = explode ( DIRECTORY_SEPARATOR , $ module -> getPath ( ) ) ; $ parent = $ path [ count ( $ path ) - 3 ] ; return strpos ( $ parent , $ identifier ) !== 0 ; } ; return array_filter ( $ this -> getAll ( ) , $ filter ) ; }
Returns extension objects for all main Lightning components.

@return Extension[]
Array of extension objects for top-level Lightning components.
Returns extension objects for all main Lightning components .