FusionDirectory
class_ldapMultiplexer.inc
Go to the documentation of this file.
1 <?php
2 
3 /*
4  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
5  Copyright (C) 2003-2010 Cajus Pollmeier
6  Copyright (C) 2011-2016 FusionDirectory
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22 
45 {
46 
47  /* Internal stuff */
48  protected $object;
49 
50  /* Result resource */
51  protected $sr;
52 
58  public function __construct (&$object)
59  {
60  /* Store object */
61  $this->object = $object;
62 
63  /* Set result resource */
64  $this->sr = $this->object->getSearchResource();
65  }
66 
74  public function __call ($methodName, $parameters)
75  {
76  /* Add resource pointer if the mentioned methods are used */
77  if (in_array($methodName, ['search','ls','cat','fetch','clearResult','resetResult','count','getDN','rmdir_recursive','create_missing_trees','import_single_entry','import_complete_ldif','parse_result'])) {
78  array_unshift($parameters, $this->sr);
79  }
80 
81  return call_user_func_array([$this->object, $methodName], $parameters);
82  }
83 
84  /*
85  * \brief Get a member name from a ldap object
86  *
87  * \param string $memberName
88  */
89  public function __get ($memberName)
90  {
91  return $this->object->$memberName;
92  }
93 }
__call($methodName, $parameters)
Call a ldap method with his parameters.
__construct(&$object)
LADP multiplexer constructor.