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 array_key_exists;
13
use function array_values;
14
use function strtolower;
15
 
16
/**
17
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
18
 */
19
final class MockMethodSet
20
{
21
    /**
22
     * @var MockMethod[]
23
     */
24
    private $methods = [];
25
 
26
    public function addMethods(MockMethod ...$methods): void
27
    {
28
        foreach ($methods as $method) {
29
            $this->methods[strtolower($method->getName())] = $method;
30
        }
31
    }
32
 
33
    /**
34
     * @return MockMethod[]
35
     */
36
    public function asArray(): array
37
    {
38
        return array_values($this->methods);
39
    }
40
 
41
    public function hasMethod(string $methodName): bool
42
    {
43
        return array_key_exists(strtolower($methodName), $this->methods);
44
    }
45
}