/usr/share/php/Prophecy/Argument.php is in php-phpspec-prophecy 1.6.2-1.
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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | <?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy;
use Prophecy\Argument\Token;
/**
* Argument tokens shortcuts.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class Argument
{
/**
* Checks that argument is exact value or object.
*
* @param mixed $value
*
* @return Token\ExactValueToken
*/
public static function exact($value)
{
return new Token\ExactValueToken($value);
}
/**
* Checks that argument is of specific type or instance of specific class.
*
* @param string $type Type name (`integer`, `string`) or full class name
*
* @return Token\TypeToken
*/
public static function type($type)
{
return new Token\TypeToken($type);
}
/**
* Checks that argument object has specific state.
*
* @param string $methodName
* @param mixed $value
*
* @return Token\ObjectStateToken
*/
public static function which($methodName, $value)
{
return new Token\ObjectStateToken($methodName, $value);
}
/**
* Checks that argument matches provided callback.
*
* @param callable $callback
*
* @return Token\CallbackToken
*/
public static function that($callback)
{
return new Token\CallbackToken($callback);
}
/**
* Matches any single value.
*
* @return Token\AnyValueToken
*/
public static function any()
{
return new Token\AnyValueToken;
}
/**
* Matches all values to the rest of the signature.
*
* @return Token\AnyValuesToken
*/
public static function cetera()
{
return new Token\AnyValuesToken;
}
/**
* Checks that argument matches all tokens
*
* @param mixed ... a list of tokens
*
* @return Token\LogicalAndToken
*/
public static function allOf()
{
return new Token\LogicalAndToken(func_get_args());
}
/**
* Checks that argument array or countable object has exact number of elements.
*
* @param integer $value array elements count
*
* @return Token\ArrayCountToken
*/
public static function size($value)
{
return new Token\ArrayCountToken($value);
}
/**
* Checks that argument array contains (key, value) pair
*
* @param mixed $key exact value or token
* @param mixed $value exact value or token
*
* @return Token\ArrayEntryToken
*/
public static function withEntry($key, $value)
{
return new Token\ArrayEntryToken($key, $value);
}
/**
* Checks that arguments array entries all match value
*
* @param mixed $value
*
* @return Token\ArrayEveryEntryToken
*/
public static function withEveryEntry($value)
{
return new Token\ArrayEveryEntryToken($value);
}
/**
* Checks that argument array contains value
*
* @param mixed $value
*
* @return Token\ArrayEntryToken
*/
public static function containing($value)
{
return new Token\ArrayEntryToken(self::any(), $value);
}
/**
* Checks that argument array has key
*
* @param mixed $key exact value or token
*
* @return Token\ArrayEntryToken
*/
public static function withKey($key)
{
return new Token\ArrayEntryToken($key, self::any());
}
/**
* Checks that argument does not match the value|token.
*
* @param mixed $value either exact value or argument token
*
* @return Token\LogicalNotToken
*/
public static function not($value)
{
return new Token\LogicalNotToken($value);
}
/**
* @param string $value
*
* @return Token\StringContainsToken
*/
public static function containingString($value)
{
return new Token\StringContainsToken($value);
}
/**
* Checks that argument is identical value.
*
* @param mixed $value
*
* @return Token\IdenticalValueToken
*/
public static function is($value)
{
return new Token\IdenticalValueToken($value);
}
/**
* Check that argument is same value when rounding to the
* given precision.
*
* @param float $value
* @param float $precision
*
* @return Token\ApproximateValueToken
*/
public static function approximate($value, $precision = 0)
{
return new Token\ApproximateValueToken($value, $precision);
}
}
|