$this->_params['basedn'],
Horde_Ldap_Filter::build($this->_params),
$params)
- ->as_struct();
+ ->asArray();
$uid = Horde_String::lower($this->_params['uid']);
foreach ($search as $val) {
$userlist[] = $val[$uid][0];
throw new Horde_Group_Exception($e);
}
- foreach ($search->sorted_as_struct(array($this->_params['gid'])) as $entry) {
+ foreach ($search->sortedAsArray(array($this->_params['gid'])) as $entry) {
$this->_listCache[$entry['dn']] = $this->getGroupName($entry['dn']);
}
*
* @return array The resulting array.
*/
- public function as_struct()
+ public function asArray()
{
return $this->_result;
}
*/
public function asArray()
{
- return $this->_search->as_struct();
+ return $this->_search->asArray();
}
}
\ No newline at end of file
'dn' => 'cn=d',
),
),
- $a->as_struct()
+ $a->asArray()
);
$a = $conn->search(null, '(c=3)');
'dn' => 'cn=c',
),
),
- $a->as_struct()
+ $a->asArray()
);
$a = $conn->search(null, '(c=3)', array('attributes' => array('a')));
'dn' => 'cn=c',
),
),
- $a->as_struct()
+ $a->asArray()
);
$a = $conn->search(null, '(&(a=1)(b=2))', array('attributes' => array('a', 'b')));
'dn' => 'cn=c',
),
),
- $a->as_struct()
+ $a->asArray()
);
$a = $conn->search(null, '(|(a=1)(b=2))', array('attributes' => array('a', 'b')));
'dn' => 'cn=d',
)
),
- $a->as_struct()
+ $a->asArray()
);
$a = $conn->search(null, '(&(b=2))', array('attributes' => array('b')));
'dn' => 'cn=d',
),
),
- $a->as_struct()
+ $a->asArray()
);
$a = $conn->search(null, '(!(b=2))', array('attributes' => array('a', 'b')));
'dn' => 'cn=a',
),
),
- $a->as_struct()
+ $a->asArray()
);
$a = $conn->search(null, '(&(!(x=2))(b=1))', array('attributes' => array('b')));
'dn' => 'cn=a',
),
),
- $a->as_struct()
+ $a->asArray()
);
$a = $conn->search(null, '(c=t)', array('attributes' => array('a')));
$this->assertEquals(
array(),
- $a->as_struct()
+ $a->asArray()
);
try {
'dn' => 'test'
)
),
- $result->as_struct()
+ $result->asArray()
);
}
$result = $conn->search('test', null, array('scope' => 'base'));
$this->assertEquals(
array(),
- $result->as_struct()
+ $result->asArray()
);
}
'dn' => 'test'
)
),
- $result->as_struct()
+ $result->asArray()
);
}
$result = $conn->search('test');
$this->assertEquals(
array('test', 'yestest'),
- array_keys($result->as_struct())
+ array_keys($result->asArray())
);
}
'dn' => 'yestest'
),
),
- $result->as_struct()
+ $result->asArray()
);
}
private function getSearchResultMock()
{
$result = $this->getMock(
- 'Horde_Ldap_Search', array('as_struct', 'count'), array(), '', false
+ 'Horde_Ldap_Search', array('asArray', 'count'), array(), '', false
);
$result->expects($this->any())
- ->method('as_struct')
+ ->method('asArray')
->will($this->returnValue(array(array('dn' => 'test'))));
$result->expects($this->any())
->method('count')
private function getSearchResultMock()
{
$result = $this->getMock(
- 'Horde_Ldap_Search', array('as_struct', 'count'), array(), '', false
+ 'Horde_Ldap_Search', array('asArray', 'count'), array(), '', false
);
$result->expects($this->any())
- ->method('as_struct')
+ ->method('asArray')
->will($this->returnValue(array(array('dn' => 'test'))));
$result->expects($this->any())
->method('count')
private function getSearchResultMock()
{
$result = $this->getMock(
- 'Horde_Ldap_Search', array('as_struct', 'count'), array(), '', false
+ 'Horde_Ldap_Search', array('asArray', 'count'), array(), '', false
);
$result->expects($this->any())
- ->method('as_struct')
+ ->method('asArray')
->will($this->returnValue(array(array('dn' => 'test'))));
$result->expects($this->any())
->method('count')
public function testMethodReadThrowsExceptionIfTheObjectWasNotFound()
{
$result = $this->getMock(
- 'Horde_Ldap_Search', array('as_struct', 'count'), array(), '', false
+ 'Horde_Ldap_Search', array('asArray', 'count'), array(), '', false
);
$result->expects($this->exactly(1))
->method('count')
public function testMethodReadAttributesThrowsExceptionIfTheObjectWasNotFound()
{
$result = $this->getMock(
- 'Horde_Ldap_Search', array('as_struct', 'count'), array(), '', false
+ 'Horde_Ldap_Search', array('asArray', 'count'), array(), '', false
);
$result->expects($this->exactly(1))
->method('count')
public function testMethodAsarrayHasResultArrayWithTheSearchResults()
{
$search = $this->getMock(
- 'Horde_Ldap_Search', array('as_struct'), array(), '', false
+ 'Horde_Ldap_Search', array('asArray'), array(), '', false
);
$search->expects($this->exactly(1))
- ->method('as_struct')
+ ->method('asArray')
->will($this->returnValue(array('a' => 'a')));
$result = new Horde_Kolab_Server_Result_Ldap($search);
$this->assertEquals(array('a' => 'a'), $result->asArray());
$this->result = $result;
$this->limit = $limit;
}
- public function as_struct()
+ public function asArray()
{
return $this->result;
}
* This returns a array with sorted entries and the values. Sorting is done
* with PHPs {@link array_multisort()}.
*
- * This method relies on {@link as_struct()} to fetch the raw data of the
+ * This method relies on {@link asArray()} to fetch the raw data of the
* entries.
*
* Please note that attribute names are case sensitive!
* Usage example:
* <code>
* // To sort entries first by location, then by surname, but descending:
- * $entries = $search->sorted_as_struct(array('locality', 'sn'), SORT_DESC);
+ * $entries = $search->sortedAsArray(array('locality', 'sn'), SORT_DESC);
* </code>
*
* @todo what about server side sorting as specified in
* @return array Sorted entries.
* @throws Horde_Ldap_Exception
*/
- public function sorted_as_struct(array $attrs = array('cn'),
+ public function sortedAsArray(array $attrs = array('cn'),
$order = SORT_ASC)
{
/* Old Code, suitable and fast for single valued sorting. This code
}
// Fetch the entries data.
- $entries = $this->as_struct();
+ $entries = $this->asArray();
// Now sort each entries attribute values.
// This is neccessary because later we can only sort by one value, so
* Returns entries sorted as objects.
*
* This returns a array with sorted Horde_Ldap_Entry objects. The sorting
- * is actually done with {@link sorted_as_struct()}.
+ * is actually done with {@link sortedAsArray()}.
*
* Please note that attribute names are case sensitive!
*
public function sorted($attrs = array('cn'), $order = SORT_ASC)
{
$return = array();
- $sorted = $this->sorted_as_struct($attrs, $order);
+ $sorted = $this->sortedAsArray($attrs, $order);
foreach ($sorted as $key => $row) {
$entry = $this->_ldap->getEntry($row['dn'], $this->searchedAttributes());
array_push($return, $entry);
* @return array Associative result array as described above.
* @throws Horde_Ldap_Exception
*/
- public function as_struct()
+ public function asArray()
{
$return = array();
$entries = $this->entries();