1<?php
2/**
3 * An interface marking object class search operations.
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 * An interface marking object class search operations.
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 */
28abstract class Horde_Kolab_Server_Search_Operation_Base
29implements Horde_Kolab_Server_Search_Operation_Interface
30{
31    /**
32     * A link to the server structure.
33     *
34     * @var Horde_Kolab_Server_Structure_Interface
35     */
36    private $_structure;
37
38    /**
39     * Constructor
40     *
41     * @param Horde_Kolab_Server_Structure_Interface $structure A link to the
42     *                                                          server
43     *                                                          structure.
44     */
45    public function __construct(
46        Horde_Kolab_Server_Structure_Interface $structure
47    ) {
48        $this->_structure = $structure;
49    }
50
51    /**
52     * Return the reference to the server structure.
53     *
54     * @return Horde_Kolab_Server_Structure_Interface
55     */
56    public function getStructure()
57    {
58        return $this->_structure;
59    }
60
61    /**
62     * Identify the GUID(s) of the result entry(s).
63     *
64     * @param array $result The LDAP search result.
65     *
66     * @return boolean|array The GUID(s) or false if there was no result.
67     */
68    protected function guidFromResult(
69        Horde_Kolab_Server_Result_Interface $result
70    ) {
71        return array_keys($result->asArray());
72    }
73}