Esempio n. 1
0
function box($value)
{
    $type = gettype($value);
    if ($type == 'boolean') {
        return new BoxedBoolean($value);
    } elseif ($type == 'integer') {
        return new BoxedInteger($value);
    } elseif ($type == 'float' || $type == 'double') {
        return new BoxedFloat($value);
    } elseif ($type == 'string') {
        return new BoxedString($value);
    } elseif ($type == 'array') {
        return new BasicArray($value);
    } else {
        throw new TypeError();
    }
}
/**
 * Unboxes the given value.
 *
 * @param object Box box A boxed value.
 * @return mixed The value in the box.
 */
function unbox($box)
{
    return $box->getValue();
}
//}>b
if (realpath($argv[0]) == realpath(__FILE__)) {
    exit(Box::main(array_slice($argv, 1)));
}