fev/sorter
Composer 安装命令:
composer create-project fev/sorter
包简介
Simple library for sorting arrays.
README 文档
README
This library provide two methods (ascending, descending) for sorting arrays.
Installation
For install this library just execute the following command
$ composer require fev/sorter
Usage
For usage this library you need:
- Create object form basic class
Sorter
$sorter = new Sorter();
- Define 1 form 2 default sorting methods
SortingABC,SortingCBAby methodsetSortingMethod
$sorter->setSortingMethod(new SortingABC());
or
$sorter->setSortingMethod(new SortingCBA());
2.1 If you not define sorting methods, then class will be work by default mode like null object pattern.
- Use
sortmethod for sorting your array.
$sorter->sort($test_arr);
Extension
For extended this library with own sorting rules create new sorting class which
implement SorterInterface with method sort()
Tests
You can run tests with next command
$ php test.php.
License
This project is released under the terms of the BSD-3-Clause license.
Copyright (c) 2020, FEV
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2020-08-22