Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
namespace Hamcrest\Text;
3
 
4
/*
5
 Copyright (c) 2009 hamcrest.org
6
 */
7
 
8
/**
9
 * Tests if the argument is a string that ends with a substring.
10
 */
11
class StringEndsWith extends SubstringMatcher
12
{
13
 
14
    public function __construct($substring)
15
    {
16
        parent::__construct($substring);
17
    }
18
 
19
    /**
20
     * Matches if value is a string that ends with $substring.
21
     *
22
     * @factory
23
     */
24
    public static function endsWith($substring)
25
    {
26
        return new self($substring);
27
    }
28
 
29
    // -- Protected Methods
30
 
31
    protected function evalSubstringOf($string)
32
    {
33
        return (substr($string, (-1 * strlen($this->_substring))) === $this->_substring);
34
    }
35
 
36
    protected function relationship()
37
    {
38
        return 'ending with';
39
    }
40
}