src/Arrays/Group.php
public static function groupByPropertiesNames(GroupData $groupData)
    {
        self::$data = $groupData->getData();
        self::$groupProperties = $groupData->getGroupProperties();
        self::$groupCriteriaHigherLevel = $groupData->getGroupCriteriaHigherLevel();
        self::$quantityPropertyName = $groupData->getQuantityPropertyName();
        self::$groupResultType = $groupData->getGroupResultType();

        if (!is_null($groupData->getMostFrequentQuantity())) {
            self::$mostFrequentQuantity = $groupData->getMostFrequentQuantity();
        }

        self::prepareKeeper();
        self::removeRedundantProperties();

        foreach (self::$data as $basicKey => $item) {
            if (!($item instanceof \StdClass)) {
                throw new GroupException("Can't group. Not StdClass in \$item");
            }
            self::group($basicKey, $item);
        }

        switch (self::$groupResultType):
            case(GroupConsts::RESULT_GROUP_SORT_DATA):
                $result = self::getMostFrequentValuesForGrouped(self::$groupKeeper);
                break;
            case(GroupConsts::RESULT_GROUP_STRING):
                $result = self::$groupKeeper;
                break;
        endswitch;

        return $result;
    }
public static function groupByPropertiesNames(GroupData $groupData)
    {
        self::$data = $groupData->getData();
        self::$groupProperties = $groupData->getGroupProperties();
        self::$groupCriteriaHigherLevel = $groupData->getGroupCriteriaHigherLevel();
        self::$quantityPropertyName = $groupData->getQuantityPropertyName();
        self::$groupResultType = $groupData->getGroupResultType();

        if (!is_null($groupData->getMostFrequentQuantity())) {
            self::$mostFrequentQuantity = $groupData->getMostFrequentQuantity();
        }

        self::prepareKeeper();
        self::removeRedundantProperties();

        foreach (self::$data as $basicKey => $item) {
            if (!($item instanceof \StdClass)) {
                throw new GroupException("Can't group. Not StdClass in \$item");
            }
            self::group($basicKey, $item);
        }

        switch (self::$groupResultType):
            case(GroupConsts::RESULT_GROUP_SORT_DATA):
                $result = self::getMostFrequentValuesForGrouped(self::$groupKeeper);
                break;
            case(GroupConsts::RESULT_GROUP_STRING):
                $result = self::$groupKeeper;
                break;
        endswitch;

        return $result;
    }
public static function groupByPropertiesNames ( GroupData $ groupData ) { self :: $ data = $ groupData -> getData ( ) ; self :: $ groupProperties = $ groupData -> getGroupProperties ( ) ; self :: $ groupCriteriaHigherLevel = $ groupData -> getGroupCriteriaHigherLevel ( ) ; self :: $ quantityPropertyName = $ groupData -> getQuantityPropertyName ( ) ; self :: $ groupResultType = $ groupData -> getGroupResultType ( ) ; if ( ! is_null ( $ groupData -> getMostFrequentQuantity ( ) ) ) { self :: $ mostFrequentQuantity = $ groupData -> getMostFrequentQuantity ( ) ; } self :: prepareKeeper ( ) ; self :: removeRedundantProperties ( ) ; foreach ( self :: $ data as $ basicKey => $ item ) { if ( ! ( $ item instanceof \ StdClass ) ) { throw new GroupException ( "Can't group. Not StdClass in \$item" ) ; } self :: group ( $ basicKey , $ item ) ; } switch ( self :: $ groupResultType ) : case ( GroupConsts :: RESULT_GROUP_SORT_DATA ) : $ result = self :: getMostFrequentValuesForGrouped ( self :: $ groupKeeper ) ; break ; case ( GroupConsts :: RESULT_GROUP_STRING ) : $ result = self :: $ groupKeeper ; break ; endswitch ; return $ result ; }
Allow to group data with same properties by properties names.

@param GroupData $groupData
@return mixed
@throws GroupException
Allow to group data with same properties by properties names .