pocketmine\inventory\CraftingManager::sortAndAddRecipesArray PHP Method

sortAndAddRecipesArray() private method

private sortAndAddRecipesArray ( &$recipes )
    private function sortAndAddRecipesArray(&$recipes)
    {
        // Sort the recipes based on the result item name with the bubblesort algoritm.
        for ($i = 0; $i < count($recipes); ++$i) {
            $current = $recipes[$i];
            $result = $current->getResult();
            for ($j = count($recipes) - 1; $j > $i; --$j) {
                if ($this->sort($result, $recipes[$j]->getResult()) > 0) {
                    $swap = $current;
                    $current = $recipes[$j];
                    $recipes[$j] = $swap;
                    $result = $current->getResult();
                }
            }
            $this->registerRecipe($current);
        }
    }