1: <?php
2: namespace Peridot\Leo\Matcher;
3:
4: use Peridot\Leo\Matcher\Template\ArrayTemplate;
5: use Peridot\Leo\Matcher\Template\TemplateInterface;
6:
7: /**
8: * EmptyMatcher determines if an actual value is empty via the php empty() function.
9: * @package Peridot\Leo\Matcher
10: */
11: class EmptyMatcher extends AbstractMatcher
12: {
13: public function __construct()
14: {
15:
16: }
17:
18: /**
19: * Determin if the actual value is empty.
20: *
21: * @param $actual
22: * @return mixed
23: */
24: protected function doMatch($actual)
25: {
26: return empty($actual);
27: }
28:
29: /**
30: * {@inheritdoc}
31: *
32: * @return TemplateInterface
33: */
34: public function getDefaultTemplate()
35: {
36: return new ArrayTemplate([
37: 'default' => 'Expected {{actual}} to be empty',
38: 'negated' => 'Expected {{actual}} not to be empty'
39: ]);
40: }
41: }
42: