classes/collection/ElementCollection.php
public function take($iCount = 0)
    {
        $iCount = (int) trim($iCount);
        if ($this->isEmpty()) {
            return [];
        }

        if (empty($iCount)) {
            $iCount = null;
        }

        $arResultIDList = array_slice($this->arElementIDList, $this->iSkip, $iCount);
        if (empty($arResultIDList)) {
            return [];
        }

        $arResult = [];
        foreach ($arResultIDList as $iElementID) {
            $obElementItem = $this->makeItem($iElementID, null);
            if ($obElementItem->isEmpty()) {
                continue;
            }

            $arResult[$iElementID] = $obElementItem;
        }

        return $arResult;
    }
public function take($iCount = 0)
    {
        $iCount = (int) trim($iCount);
        if ($this->isEmpty()) {
            return [];
        }

        if (empty($iCount)) {
            $iCount = null;
        }

        $arResultIDList = array_slice($this->arElementIDList, $this->iSkip, $iCount);
        if (empty($arResultIDList)) {
            return [];
        }

        $arResult = [];
        foreach ($arResultIDList as $iElementID) {
            $obElementItem = $this->makeItem($iElementID, null);
            if ($obElementItem->isEmpty()) {
                continue;
            }

            $arResult[$iElementID] = $obElementItem;
        }

        return $arResult;
    }
public function take ( $ iCount = 0 ) { $ iCount = ( int ) trim ( $ iCount ) ; if ( $ this -> isEmpty ( ) ) { return [ ] ; } if ( empty ( $ iCount ) ) { $ iCount = null ; } $ arResultIDList = array_slice ( $ this -> arElementIDList , $ this -> iSkip , $ iCount ) ; if ( empty ( $ arResultIDList ) ) { return [ ] ; } $ arResult = [ ] ; foreach ( $ arResultIDList as $ iElementID ) { $ obElementItem = $ this -> makeItem ( $ iElementID , null ) ; if ( $ obElementItem -> isEmpty ( ) ) { continue ; } $ arResult [ $ iElementID ] = $ obElementItem ; } return $ arResult ; }
Take array with element items
@see  \Lovata\Toolbox\Tests\Unit\CollectionTest::testTakeMethod()
@link https://github.com/lovata/oc-toolbox-plugin/wiki/ElementCollection#takeicount--0
@param int $iCount
@return array|\Lovata\Toolbox\Classes\Item\ElementItem[]
Take array with element items