1<?php
2/**
3 * A mockup class to simulate LDAP search results.
4 *
5 * PHP version 5
6 *
7 * @category Kolab
8 * @package  Kolab_Server
9 * @author   Gunnar Wrobel <wrobel@pardus.de>
10 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
11 * @link     http://pear.horde.org/index.php?package=Kolab_Server
12 */
13
14/**
15 * A mockup class to simulate LDAP search results.
16 *
17 * Copyright 2008-2016 Horde LLC (http://www.horde.org/)
18 *
19 * See the enclosed file COPYING for license information (LGPL). If you
20 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
21 *
22 * @category Kolab
23 * @package  Kolab_Server
24 * @author   Gunnar Wrobel <wrobel@pardus.de>
25 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
26 * @link     http://pear.horde.org/index.php?package=Kolab_Server
27 */
28class Horde_Kolab_Server_Connection_Mock_Search
29extends Horde_Ldap_Search
30{
31    /**
32     * The search result.
33     *
34     * @var array
35     */
36    private $_result;
37
38    /**
39     * Constructor.
40     *
41     * @param array $result The search result.
42     */
43    public function __construct(array $result)
44    {
45        $this->_result = $result;
46    }
47
48    /**
49     * The number of result entries.
50     *
51     * @return int The number of elements.
52     */
53    public function count()
54    {
55        return count($this->_result);
56    }
57
58    /**
59     * Test if the last search exceeded the size limit.
60     *
61     * @return boolean True if the last search exceeded the size limit.
62     */
63    public function sizeLimitExceeded()
64    {
65        return false;
66    }
67
68    /**
69     * Return the result as an array.
70     *
71     * @return array The resulting array.
72     */
73    public function asArray()
74    {
75        return $this->_result;
76    }
77
78}
79