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;
3
 
4
/*
5
 Copyright (c) 2009 hamcrest.org
6
 */
7
 
8
/**
9
 * A {@link Hamcrest\Description} that is stored as a string.
10
 */
11
class StringDescription extends BaseDescription
12
{
13
 
14
    private $_out;
15
 
16
    public function __construct($out = '')
17
    {
18
        $this->_out = (string) $out;
19
    }
20
 
21
    public function __toString()
22
    {
23
        return $this->_out;
24
    }
25
 
26
    /**
27
     * Return the description of a {@link Hamcrest\SelfDescribing} object as a
28
     * String.
29
     *
30
     * @param \Hamcrest\SelfDescribing $selfDescribing
31
     *   The object to be described.
32
     *
33
     * @return string
34
     *   The description of the object.
35
     */
36
    public static function toString(SelfDescribing $selfDescribing)
37
    {
38
        $self = new self();
39
 
40
        return (string) $self->appendDescriptionOf($selfDescribing);
41
    }
42
 
43
    /**
44
     * Alias for {@link toString()}.
45
     */
46
    public static function asString(SelfDescribing $selfDescribing)
47
    {
48
        return self::toString($selfDescribing);
49
    }
50
 
51
    // -- Protected Methods
52
 
53
    protected function append($str)
54
    {
55
        $this->_out .= $str;
56
    }
57
}