Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of PHPUnit.
4
 *
5
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PHPUnit\Framework\MockObject;
11
 
12
use function is_string;
13
use function sprintf;
14
use function strtolower;
15
use PHPUnit\Framework\Constraint\Constraint;
16
 
17
/**
18
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
19
 */
20
final class MethodNameConstraint extends Constraint
21
{
22
    /**
23
     * @var string
24
     */
25
    private $methodName;
26
 
27
    public function __construct(string $methodName)
28
    {
29
        $this->methodName = $methodName;
30
    }
31
 
32
    public function toString(): string
33
    {
34
        return sprintf(
35
            'is "%s"',
36
            $this->methodName
37
        );
38
    }
39
 
40
    protected function matches($other): bool
41
    {
42
        if (!is_string($other)) {
43
            return false;
44
        }
45
 
46
        return strtolower($this->methodName) === strtolower($other);
47
    }
48
}