Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Jingga
4 *
5 * PHP Version 8.1
6 *
7 * @package   phpOMS\Algorithm\Sort;
8 * @copyright Dennis Eichhorn
9 * @license   OMS License 2.0
10 * @version   1.0.0
11 * @link      https://jingga.app
12 */
13declare(strict_types=1);
14
15namespace phpOMS\Algorithm\Sort;
16
17/**
18 * SortableInterface class.
19 *
20 * @package phpOMS\Algorithm\Sort;
21 * @license OMS License 2.0
22 * @link    https://jingga.app
23 * @since   1.0.0
24 */
25interface SortableInterface
26{
27    /**
28     * Compare current object with other object
29     *
30     * @param SortableInterface $obj   Object to compare with
31     * @param int               $order Sort order
32     *
33     * @return bool
34     *
35     * @since 1.0.0
36     */
37    public function compare(self $obj, int $order = SortOrder::ASC) : bool;
38
39    /**
40     * Get element value
41     *
42     * @return mixed
43     *
44     * @since 1.0.0
45     */
46    public function getValue();
47
48    /**
49     * Is value the same
50     *
51     * @param SortableInterface $obj Object to compare with
52     *
53     * @return bool
54     *
55     * @since 1.0.0
56     */
57    public function equals(self $obj) : bool;
58
59    /**
60     * Get maximum element
61     *
62     * @param SortableInterface[] $list List to order
63     *
64     * @return mixed
65     *
66     * @since 1.0.0
67     */
68    public static function max(array $list);
69
70    /**
71     * Get minimum element
72     *
73     * @param SortableInterface[] $list List to order
74     *
75     * @return mixed
76     *
77     * @since 1.0.0
78     */
79    public static function min(array $list);
80}