- removed obsolete autoloader and get_temp_dir() functions - indenting/bracing style mostly PSR1-style.
37 lines
686 B
PHP
37 lines
686 B
PHP
<?php
|
|
/**
|
|
*
|
|
* Boxed scalar values, usable with classes implementing Comparable_Interface.
|
|
*
|
|
* @copyright (c) 2007 OSI
|
|
* @license Licensed under the CeCILL 2.0
|
|
*/
|
|
|
|
|
|
/**
|
|
* This class enables use of scalar values with classes implementing Comparable_Interface
|
|
* @package default
|
|
*/
|
|
class boxed_int implements Comparable_Interface {
|
|
protected $value;
|
|
|
|
function __construct($n) {
|
|
$this->value = $n;
|
|
}
|
|
|
|
function cmp(Comparable_Interface $other) {
|
|
if ($this->value < $other->value) {
|
|
return -1;
|
|
}
|
|
elseif ($this->value > $other->value) {
|
|
return 1;
|
|
}
|
|
else {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
function as_int() {
|
|
return $this->value;
|
|
}
|
|
}
|