This file is indexed.

/usr/share/php/Hamcrest/Number/OrderingComparison.php is in php-hamcrest 1.2.2-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
namespace Hamcrest\Number;

/*
 Copyright (c) 2009 hamcrest.org
 */

use Hamcrest\Description;
use Hamcrest\TypeSafeMatcher;

class OrderingComparison extends TypeSafeMatcher
{

    private $_value;
    private $_minCompare;
    private $_maxCompare;

    public function __construct($value, $minCompare, $maxCompare)
    {
        parent::__construct(self::TYPE_NUMERIC);

        $this->_value = $value;
        $this->_minCompare = $minCompare;
        $this->_maxCompare = $maxCompare;
    }

    protected function matchesSafely($other)
    {
        $compare = $this->_compare($this->_value, $other);

        return ($this->_minCompare <= $compare) && ($compare <= $this->_maxCompare);
    }

    protected function describeMismatchSafely($item, Description $mismatchDescription)
    {
        $mismatchDescription
            ->appendValue($item)->appendText(' was ')
            ->appendText($this->_comparison($this->_compare($this->_value, $item)))
            ->appendText(' ')->appendValue($this->_value)
            ;
    }

    public function describeTo(Description $description)
    {
        $description->appendText('a value ')
            ->appendText($this->_comparison($this->_minCompare))
            ;
        if ($this->_minCompare != $this->_maxCompare) {
            $description->appendText(' or ')
                ->appendText($this->_comparison($this->_maxCompare))
                ;
        }
        $description->appendText(' ')->appendValue($this->_value);
    }

    /**
     * The value is not > $value, nor < $value.
     *
     * @factory
     */
    public static function comparesEqualTo($value)
    {
        return new self($value, 0, 0);
    }

    /**
     * The value is > $value.
     *
     * @factory
     */
    public static function greaterThan($value)
    {
        return new self($value, -1, -1);
    }

    /**
     * The value is >= $value.
     *
     * @factory atLeast
     */
    public static function greaterThanOrEqualTo($value)
    {
        return new self($value, -1, 0);
    }

    /**
     * The value is < $value.
     *
     * @factory
     */
    public static function lessThan($value)
    {
        return new self($value, 1, 1);
    }

    /**
     * The value is <= $value.
     *
     * @factory atMost
     */
    public static function lessThanOrEqualTo($value)
    {
        return new self($value, 0, 1);
    }

    // -- Private Methods

    private function _compare($left, $right)
    {
        $a = $left;
        $b = $right;

        if ($a < $b) {
            return -1;
        } elseif ($a == $b) {
            return 0;
        } else {
            return 1;
        }
    }

    private function _comparison($compare)
    {
        if ($compare > 0) {
            return 'less than';
        } elseif ($compare == 0) {
            return 'equal to';
        } else {
            return 'greater than';
        }
    }
}