PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php

https://gitlab.com/ealexis.t/trends
PHP | 805 lines | 485 code | 80 blank | 240 comment | 78 complexity | 5eecc5a177f6b8937266e2bdbeb06ecd MD5 | raw file
  1. <?php
  2. /*
  3. Copyright (c) 2009-2010 hamcrest.org
  4. */
  5. // This file is generated from the static method @factory doctags.
  6. if (!function_exists('assertThat')) {
  7. /**
  8. * Make an assertion and throw {@link Hamcrest_AssertionError} if it fails.
  9. *
  10. * Example:
  11. * <pre>
  12. * //With an identifier
  13. * assertThat("assertion identifier", $apple->flavour(), equalTo("tasty"));
  14. * //Without an identifier
  15. * assertThat($apple->flavour(), equalTo("tasty"));
  16. * //Evaluating a boolean expression
  17. * assertThat("some error", $a > $b);
  18. * </pre>
  19. */
  20. function assertThat()
  21. {
  22. $args = func_get_args();
  23. call_user_func_array(
  24. array('Hamcrest\MatcherAssert', 'assertThat'),
  25. $args
  26. );
  27. }
  28. }
  29. if (!function_exists('anArray')) { /**
  30. * Evaluates to true only if each $matcher[$i] is satisfied by $array[$i].
  31. */
  32. function anArray(/* args... */)
  33. {
  34. $args = func_get_args();
  35. return call_user_func_array(array('\Hamcrest\Arrays\IsArray', 'anArray'), $args);
  36. }
  37. }
  38. if (!function_exists('hasItemInArray')) { /**
  39. * Evaluates to true if any item in an array satisfies the given matcher.
  40. *
  41. * @param mixed $item as a {@link Hamcrest\Matcher} or a value.
  42. *
  43. * @return \Hamcrest\Arrays\IsArrayContaining
  44. */
  45. function hasItemInArray($item)
  46. {
  47. return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item);
  48. }
  49. }
  50. if (!function_exists('hasValue')) { /**
  51. * Evaluates to true if any item in an array satisfies the given matcher.
  52. *
  53. * @param mixed $item as a {@link Hamcrest\Matcher} or a value.
  54. *
  55. * @return \Hamcrest\Arrays\IsArrayContaining
  56. */
  57. function hasValue($item)
  58. {
  59. return \Hamcrest\Arrays\IsArrayContaining::hasItemInArray($item);
  60. }
  61. }
  62. if (!function_exists('arrayContainingInAnyOrder')) { /**
  63. * An array with elements that match the given matchers.
  64. */
  65. function arrayContainingInAnyOrder(/* args... */)
  66. {
  67. $args = func_get_args();
  68. return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
  69. }
  70. }
  71. if (!function_exists('containsInAnyOrder')) { /**
  72. * An array with elements that match the given matchers.
  73. */
  74. function containsInAnyOrder(/* args... */)
  75. {
  76. $args = func_get_args();
  77. return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInAnyOrder', 'arrayContainingInAnyOrder'), $args);
  78. }
  79. }
  80. if (!function_exists('arrayContaining')) { /**
  81. * An array with elements that match the given matchers in the same order.
  82. */
  83. function arrayContaining(/* args... */)
  84. {
  85. $args = func_get_args();
  86. return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args);
  87. }
  88. }
  89. if (!function_exists('contains')) { /**
  90. * An array with elements that match the given matchers in the same order.
  91. */
  92. function contains(/* args... */)
  93. {
  94. $args = func_get_args();
  95. return call_user_func_array(array('\Hamcrest\Arrays\IsArrayContainingInOrder', 'arrayContaining'), $args);
  96. }
  97. }
  98. if (!function_exists('hasKeyInArray')) { /**
  99. * Evaluates to true if any key in an array matches the given matcher.
  100. *
  101. * @param mixed $key as a {@link Hamcrest\Matcher} or a value.
  102. *
  103. * @return \Hamcrest\Arrays\IsArrayContainingKey
  104. */
  105. function hasKeyInArray($key)
  106. {
  107. return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key);
  108. }
  109. }
  110. if (!function_exists('hasKey')) { /**
  111. * Evaluates to true if any key in an array matches the given matcher.
  112. *
  113. * @param mixed $key as a {@link Hamcrest\Matcher} or a value.
  114. *
  115. * @return \Hamcrest\Arrays\IsArrayContainingKey
  116. */
  117. function hasKey($key)
  118. {
  119. return \Hamcrest\Arrays\IsArrayContainingKey::hasKeyInArray($key);
  120. }
  121. }
  122. if (!function_exists('hasKeyValuePair')) { /**
  123. * Test if an array has both an key and value in parity with each other.
  124. */
  125. function hasKeyValuePair($key, $value)
  126. {
  127. return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value);
  128. }
  129. }
  130. if (!function_exists('hasEntry')) { /**
  131. * Test if an array has both an key and value in parity with each other.
  132. */
  133. function hasEntry($key, $value)
  134. {
  135. return \Hamcrest\Arrays\IsArrayContainingKeyValuePair::hasKeyValuePair($key, $value);
  136. }
  137. }
  138. if (!function_exists('arrayWithSize')) { /**
  139. * Does array size satisfy a given matcher?
  140. *
  141. * @param \Hamcrest\Matcher|int $size as a {@link Hamcrest\Matcher} or a value.
  142. *
  143. * @return \Hamcrest\Arrays\IsArrayWithSize
  144. */
  145. function arrayWithSize($size)
  146. {
  147. return \Hamcrest\Arrays\IsArrayWithSize::arrayWithSize($size);
  148. }
  149. }
  150. if (!function_exists('emptyArray')) { /**
  151. * Matches an empty array.
  152. */
  153. function emptyArray()
  154. {
  155. return \Hamcrest\Arrays\IsArrayWithSize::emptyArray();
  156. }
  157. }
  158. if (!function_exists('nonEmptyArray')) { /**
  159. * Matches an empty array.
  160. */
  161. function nonEmptyArray()
  162. {
  163. return \Hamcrest\Arrays\IsArrayWithSize::nonEmptyArray();
  164. }
  165. }
  166. if (!function_exists('emptyTraversable')) { /**
  167. * Returns true if traversable is empty.
  168. */
  169. function emptyTraversable()
  170. {
  171. return \Hamcrest\Collection\IsEmptyTraversable::emptyTraversable();
  172. }
  173. }
  174. if (!function_exists('nonEmptyTraversable')) { /**
  175. * Returns true if traversable is not empty.
  176. */
  177. function nonEmptyTraversable()
  178. {
  179. return \Hamcrest\Collection\IsEmptyTraversable::nonEmptyTraversable();
  180. }
  181. }
  182. if (!function_exists('traversableWithSize')) { /**
  183. * Does traversable size satisfy a given matcher?
  184. */
  185. function traversableWithSize($size)
  186. {
  187. return \Hamcrest\Collection\IsTraversableWithSize::traversableWithSize($size);
  188. }
  189. }
  190. if (!function_exists('allOf')) { /**
  191. * Evaluates to true only if ALL of the passed in matchers evaluate to true.
  192. */
  193. function allOf(/* args... */)
  194. {
  195. $args = func_get_args();
  196. return call_user_func_array(array('\Hamcrest\Core\AllOf', 'allOf'), $args);
  197. }
  198. }
  199. if (!function_exists('anyOf')) { /**
  200. * Evaluates to true if ANY of the passed in matchers evaluate to true.
  201. */
  202. function anyOf(/* args... */)
  203. {
  204. $args = func_get_args();
  205. return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'anyOf'), $args);
  206. }
  207. }
  208. if (!function_exists('noneOf')) { /**
  209. * Evaluates to false if ANY of the passed in matchers evaluate to true.
  210. */
  211. function noneOf(/* args... */)
  212. {
  213. $args = func_get_args();
  214. return call_user_func_array(array('\Hamcrest\Core\AnyOf', 'noneOf'), $args);
  215. }
  216. }
  217. if (!function_exists('both')) { /**
  218. * This is useful for fluently combining matchers that must both pass.
  219. * For example:
  220. * <pre>
  221. * assertThat($string, both(containsString("a"))->andAlso(containsString("b")));
  222. * </pre>
  223. */
  224. function both(\Hamcrest\Matcher $matcher)
  225. {
  226. return \Hamcrest\Core\CombinableMatcher::both($matcher);
  227. }
  228. }
  229. if (!function_exists('either')) { /**
  230. * This is useful for fluently combining matchers where either may pass,
  231. * for example:
  232. * <pre>
  233. * assertThat($string, either(containsString("a"))->orElse(containsString("b")));
  234. * </pre>
  235. */
  236. function either(\Hamcrest\Matcher $matcher)
  237. {
  238. return \Hamcrest\Core\CombinableMatcher::either($matcher);
  239. }
  240. }
  241. if (!function_exists('describedAs')) { /**
  242. * Wraps an existing matcher and overrides the description when it fails.
  243. */
  244. function describedAs(/* args... */)
  245. {
  246. $args = func_get_args();
  247. return call_user_func_array(array('\Hamcrest\Core\DescribedAs', 'describedAs'), $args);
  248. }
  249. }
  250. if (!function_exists('everyItem')) { /**
  251. * @param Matcher $itemMatcher
  252. * A matcher to apply to every element in an array.
  253. *
  254. * @return \Hamcrest\Core\Every
  255. * Evaluates to TRUE for a collection in which every item matches $itemMatcher
  256. */
  257. function everyItem(\Hamcrest\Matcher $itemMatcher)
  258. {
  259. return \Hamcrest\Core\Every::everyItem($itemMatcher);
  260. }
  261. }
  262. if (!function_exists('hasToString')) { /**
  263. * Does array size satisfy a given matcher?
  264. */
  265. function hasToString($matcher)
  266. {
  267. return \Hamcrest\Core\HasToString::hasToString($matcher);
  268. }
  269. }
  270. if (!function_exists('is')) { /**
  271. * Decorates another Matcher, retaining the behavior but allowing tests
  272. * to be slightly more expressive.
  273. *
  274. * For example: assertThat($cheese, equalTo($smelly))
  275. * vs. assertThat($cheese, is(equalTo($smelly)))
  276. */
  277. function is($value)
  278. {
  279. return \Hamcrest\Core\Is::is($value);
  280. }
  281. }
  282. if (!function_exists('anything')) { /**
  283. * This matcher always evaluates to true.
  284. *
  285. * @param string $description A meaningful string used when describing itself.
  286. *
  287. * @return \Hamcrest\Core\IsAnything
  288. */
  289. function anything($description = 'ANYTHING')
  290. {
  291. return \Hamcrest\Core\IsAnything::anything($description);
  292. }
  293. }
  294. if (!function_exists('hasItem')) { /**
  295. * Test if the value is an array containing this matcher.
  296. *
  297. * Example:
  298. * <pre>
  299. * assertThat(array('a', 'b'), hasItem(equalTo('b')));
  300. * //Convenience defaults to equalTo()
  301. * assertThat(array('a', 'b'), hasItem('b'));
  302. * </pre>
  303. */
  304. function hasItem(/* args... */)
  305. {
  306. $args = func_get_args();
  307. return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItem'), $args);
  308. }
  309. }
  310. if (!function_exists('hasItems')) { /**
  311. * Test if the value is an array containing elements that match all of these
  312. * matchers.
  313. *
  314. * Example:
  315. * <pre>
  316. * assertThat(array('a', 'b', 'c'), hasItems(equalTo('a'), equalTo('b')));
  317. * </pre>
  318. */
  319. function hasItems(/* args... */)
  320. {
  321. $args = func_get_args();
  322. return call_user_func_array(array('\Hamcrest\Core\IsCollectionContaining', 'hasItems'), $args);
  323. }
  324. }
  325. if (!function_exists('equalTo')) { /**
  326. * Is the value equal to another value, as tested by the use of the "=="
  327. * comparison operator?
  328. */
  329. function equalTo($item)
  330. {
  331. return \Hamcrest\Core\IsEqual::equalTo($item);
  332. }
  333. }
  334. if (!function_exists('identicalTo')) { /**
  335. * Tests of the value is identical to $value as tested by the "===" operator.
  336. */
  337. function identicalTo($value)
  338. {
  339. return \Hamcrest\Core\IsIdentical::identicalTo($value);
  340. }
  341. }
  342. if (!function_exists('anInstanceOf')) { /**
  343. * Is the value an instance of a particular type?
  344. * This version assumes no relationship between the required type and
  345. * the signature of the method that sets it up, for example in
  346. * <code>assertThat($anObject, anInstanceOf('Thing'));</code>
  347. */
  348. function anInstanceOf($theClass)
  349. {
  350. return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass);
  351. }
  352. }
  353. if (!function_exists('any')) { /**
  354. * Is the value an instance of a particular type?
  355. * This version assumes no relationship between the required type and
  356. * the signature of the method that sets it up, for example in
  357. * <code>assertThat($anObject, anInstanceOf('Thing'));</code>
  358. */
  359. function any($theClass)
  360. {
  361. return \Hamcrest\Core\IsInstanceOf::anInstanceOf($theClass);
  362. }
  363. }
  364. if (!function_exists('not')) { /**
  365. * Matches if value does not match $value.
  366. */
  367. function not($value)
  368. {
  369. return \Hamcrest\Core\IsNot::not($value);
  370. }
  371. }
  372. if (!function_exists('nullValue')) { /**
  373. * Matches if value is null.
  374. */
  375. function nullValue()
  376. {
  377. return \Hamcrest\Core\IsNull::nullValue();
  378. }
  379. }
  380. if (!function_exists('notNullValue')) { /**
  381. * Matches if value is not null.
  382. */
  383. function notNullValue()
  384. {
  385. return \Hamcrest\Core\IsNull::notNullValue();
  386. }
  387. }
  388. if (!function_exists('sameInstance')) { /**
  389. * Creates a new instance of IsSame.
  390. *
  391. * @param mixed $object
  392. * The predicate evaluates to true only when the argument is
  393. * this object.
  394. *
  395. * @return \Hamcrest\Core\IsSame
  396. */
  397. function sameInstance($object)
  398. {
  399. return \Hamcrest\Core\IsSame::sameInstance($object);
  400. }
  401. }
  402. if (!function_exists('typeOf')) { /**
  403. * Is the value a particular built-in type?
  404. */
  405. function typeOf($theType)
  406. {
  407. return \Hamcrest\Core\IsTypeOf::typeOf($theType);
  408. }
  409. }
  410. if (!function_exists('set')) { /**
  411. * Matches if value (class, object, or array) has named $property.
  412. */
  413. function set($property)
  414. {
  415. return \Hamcrest\Core\Set::set($property);
  416. }
  417. }
  418. if (!function_exists('notSet')) { /**
  419. * Matches if value (class, object, or array) does not have named $property.
  420. */
  421. function notSet($property)
  422. {
  423. return \Hamcrest\Core\Set::notSet($property);
  424. }
  425. }
  426. if (!function_exists('closeTo')) { /**
  427. * Matches if value is a number equal to $value within some range of
  428. * acceptable error $delta.
  429. */
  430. function closeTo($value, $delta)
  431. {
  432. return \Hamcrest\Number\IsCloseTo::closeTo($value, $delta);
  433. }
  434. }
  435. if (!function_exists('comparesEqualTo')) { /**
  436. * The value is not > $value, nor < $value.
  437. */
  438. function comparesEqualTo($value)
  439. {
  440. return \Hamcrest\Number\OrderingComparison::comparesEqualTo($value);
  441. }
  442. }
  443. if (!function_exists('greaterThan')) { /**
  444. * The value is > $value.
  445. */
  446. function greaterThan($value)
  447. {
  448. return \Hamcrest\Number\OrderingComparison::greaterThan($value);
  449. }
  450. }
  451. if (!function_exists('greaterThanOrEqualTo')) { /**
  452. * The value is >= $value.
  453. */
  454. function greaterThanOrEqualTo($value)
  455. {
  456. return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value);
  457. }
  458. }
  459. if (!function_exists('atLeast')) { /**
  460. * The value is >= $value.
  461. */
  462. function atLeast($value)
  463. {
  464. return \Hamcrest\Number\OrderingComparison::greaterThanOrEqualTo($value);
  465. }
  466. }
  467. if (!function_exists('lessThan')) { /**
  468. * The value is < $value.
  469. */
  470. function lessThan($value)
  471. {
  472. return \Hamcrest\Number\OrderingComparison::lessThan($value);
  473. }
  474. }
  475. if (!function_exists('lessThanOrEqualTo')) { /**
  476. * The value is <= $value.
  477. */
  478. function lessThanOrEqualTo($value)
  479. {
  480. return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value);
  481. }
  482. }
  483. if (!function_exists('atMost')) { /**
  484. * The value is <= $value.
  485. */
  486. function atMost($value)
  487. {
  488. return \Hamcrest\Number\OrderingComparison::lessThanOrEqualTo($value);
  489. }
  490. }
  491. if (!function_exists('isEmptyString')) { /**
  492. * Matches if value is a zero-length string.
  493. */
  494. function isEmptyString()
  495. {
  496. return \Hamcrest\Text\IsEmptyString::isEmptyString();
  497. }
  498. }
  499. if (!function_exists('emptyString')) { /**
  500. * Matches if value is a zero-length string.
  501. */
  502. function emptyString()
  503. {
  504. return \Hamcrest\Text\IsEmptyString::isEmptyString();
  505. }
  506. }
  507. if (!function_exists('isEmptyOrNullString')) { /**
  508. * Matches if value is null or a zero-length string.
  509. */
  510. function isEmptyOrNullString()
  511. {
  512. return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
  513. }
  514. }
  515. if (!function_exists('nullOrEmptyString')) { /**
  516. * Matches if value is null or a zero-length string.
  517. */
  518. function nullOrEmptyString()
  519. {
  520. return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
  521. }
  522. }
  523. if (!function_exists('isNonEmptyString')) { /**
  524. * Matches if value is a non-zero-length string.
  525. */
  526. function isNonEmptyString()
  527. {
  528. return \Hamcrest\Text\IsEmptyString::isNonEmptyString();
  529. }
  530. }
  531. if (!function_exists('nonEmptyString')) { /**
  532. * Matches if value is a non-zero-length string.
  533. */
  534. function nonEmptyString()
  535. {
  536. return \Hamcrest\Text\IsEmptyString::isNonEmptyString();
  537. }
  538. }
  539. if (!function_exists('equalToIgnoringCase')) { /**
  540. * Matches if value is a string equal to $string, regardless of the case.
  541. */
  542. function equalToIgnoringCase($string)
  543. {
  544. return \Hamcrest\Text\IsEqualIgnoringCase::equalToIgnoringCase($string);
  545. }
  546. }
  547. if (!function_exists('equalToIgnoringWhiteSpace')) { /**
  548. * Matches if value is a string equal to $string, regardless of whitespace.
  549. */
  550. function equalToIgnoringWhiteSpace($string)
  551. {
  552. return \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace($string);
  553. }
  554. }
  555. if (!function_exists('matchesPattern')) { /**
  556. * Matches if value is a string that matches regular expression $pattern.
  557. */
  558. function matchesPattern($pattern)
  559. {
  560. return \Hamcrest\Text\MatchesPattern::matchesPattern($pattern);
  561. }
  562. }
  563. if (!function_exists('containsString')) { /**
  564. * Matches if value is a string that contains $substring.
  565. */
  566. function containsString($substring)
  567. {
  568. return \Hamcrest\Text\StringContains::containsString($substring);
  569. }
  570. }
  571. if (!function_exists('containsStringIgnoringCase')) { /**
  572. * Matches if value is a string that contains $substring regardless of the case.
  573. */
  574. function containsStringIgnoringCase($substring)
  575. {
  576. return \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase($substring);
  577. }
  578. }
  579. if (!function_exists('stringContainsInOrder')) { /**
  580. * Matches if value contains $substrings in a constrained order.
  581. */
  582. function stringContainsInOrder(/* args... */)
  583. {
  584. $args = func_get_args();
  585. return call_user_func_array(array('\Hamcrest\Text\StringContainsInOrder', 'stringContainsInOrder'), $args);
  586. }
  587. }
  588. if (!function_exists('endsWith')) { /**
  589. * Matches if value is a string that ends with $substring.
  590. */
  591. function endsWith($substring)
  592. {
  593. return \Hamcrest\Text\StringEndsWith::endsWith($substring);
  594. }
  595. }
  596. if (!function_exists('startsWith')) { /**
  597. * Matches if value is a string that starts with $substring.
  598. */
  599. function startsWith($substring)
  600. {
  601. return \Hamcrest\Text\StringStartsWith::startsWith($substring);
  602. }
  603. }
  604. if (!function_exists('arrayValue')) { /**
  605. * Is the value an array?
  606. */
  607. function arrayValue()
  608. {
  609. return \Hamcrest\Type\IsArray::arrayValue();
  610. }
  611. }
  612. if (!function_exists('booleanValue')) { /**
  613. * Is the value a boolean?
  614. */
  615. function booleanValue()
  616. {
  617. return \Hamcrest\Type\IsBoolean::booleanValue();
  618. }
  619. }
  620. if (!function_exists('boolValue')) { /**
  621. * Is the value a boolean?
  622. */
  623. function boolValue()
  624. {
  625. return \Hamcrest\Type\IsBoolean::booleanValue();
  626. }
  627. }
  628. if (!function_exists('callableValue')) { /**
  629. * Is the value callable?
  630. */
  631. function callableValue()
  632. {
  633. return \Hamcrest\Type\IsCallable::callableValue();
  634. }
  635. }
  636. if (!function_exists('doubleValue')) { /**
  637. * Is the value a float/double?
  638. */
  639. function doubleValue()
  640. {
  641. return \Hamcrest\Type\IsDouble::doubleValue();
  642. }
  643. }
  644. if (!function_exists('floatValue')) { /**
  645. * Is the value a float/double?
  646. */
  647. function floatValue()
  648. {
  649. return \Hamcrest\Type\IsDouble::doubleValue();
  650. }
  651. }
  652. if (!function_exists('integerValue')) { /**
  653. * Is the value an integer?
  654. */
  655. function integerValue()
  656. {
  657. return \Hamcrest\Type\IsInteger::integerValue();
  658. }
  659. }
  660. if (!function_exists('intValue')) { /**
  661. * Is the value an integer?
  662. */
  663. function intValue()
  664. {
  665. return \Hamcrest\Type\IsInteger::integerValue();
  666. }
  667. }
  668. if (!function_exists('numericValue')) { /**
  669. * Is the value a numeric?
  670. */
  671. function numericValue()
  672. {
  673. return \Hamcrest\Type\IsNumeric::numericValue();
  674. }
  675. }
  676. if (!function_exists('objectValue')) { /**
  677. * Is the value an object?
  678. */
  679. function objectValue()
  680. {
  681. return \Hamcrest\Type\IsObject::objectValue();
  682. }
  683. }
  684. if (!function_exists('anObject')) { /**
  685. * Is the value an object?
  686. */
  687. function anObject()
  688. {
  689. return \Hamcrest\Type\IsObject::objectValue();
  690. }
  691. }
  692. if (!function_exists('resourceValue')) { /**
  693. * Is the value a resource?
  694. */
  695. function resourceValue()
  696. {
  697. return \Hamcrest\Type\IsResource::resourceValue();
  698. }
  699. }
  700. if (!function_exists('scalarValue')) { /**
  701. * Is the value a scalar (boolean, integer, double, or string)?
  702. */
  703. function scalarValue()
  704. {
  705. return \Hamcrest\Type\IsScalar::scalarValue();
  706. }
  707. }
  708. if (!function_exists('stringValue')) { /**
  709. * Is the value a string?
  710. */
  711. function stringValue()
  712. {
  713. return \Hamcrest\Type\IsString::stringValue();
  714. }
  715. }
  716. if (!function_exists('hasXPath')) { /**
  717. * Wraps <code>$matcher</code> with {@link Hamcrest\Core\IsEqual)
  718. * if it's not a matcher and the XPath in <code>count()</code>
  719. * if it's an integer.
  720. */
  721. function hasXPath($xpath, $matcher = null)
  722. {
  723. return \Hamcrest\Xml\HasXPath::hasXPath($xpath, $matcher);
  724. }
  725. }