public static function castToBool($mixed)
    {
        if (is_string($mixed) || $mixed instanceof Rope) {
            $lower = Rope::of($mixed)->toLower();

            if ($lower->equals(Rope::of('true'))) {
                return true;
            } elseif ($lower->equals(Rope::of('false'))) {
                return false;
            }

            throw new CoreException('Unable to cast into a bool.');
        } elseif (is_int($mixed)) {
            if ($mixed === 1) {
                return true;
            } elseif ($mixed === 0) {
                return false;
            }

            throw new CoreException('Unable to cast into a bool.');
        } elseif (is_float($mixed)) {
            if ($mixed === 1.0) {
                return true;
            } elseif ($mixed === 0.0) {
                return false;
            }

            throw new CoreException('Unable to cast into a bool.');
        } elseif (is_bool($mixed)) {
            return $mixed;
        }

        throw new CoreException('Unable to cast into a bool.');
    }