Rename methods.
authorJan Schneider <jan@horde.org>
Mon, 20 Sep 2010 13:29:42 +0000 (15:29 +0200)
committerJan Schneider <jan@horde.org>
Mon, 20 Sep 2010 13:29:42 +0000 (15:29 +0200)
framework/Auth/lib/Horde/Auth/Ldap.php
framework/Group/lib/Horde/Group/Ldap.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock/Search.php
framework/Kolab_Server/lib/Horde/Kolab/Server/Result/Ldap.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Connection/Mock/LdapTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Ldap/FilteredTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Ldap/StandardTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/LdapTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Result/LdapTest.php
framework/Kolab_Server/test/Horde/Kolab/Server/Integration/SearchTest.php
framework/Ldap/lib/Horde/Ldap/Search.php

index bc54752..67e0a1c 100644 (file)
@@ -391,7 +391,7 @@ class Horde_Auth_Ldap extends Horde_Auth_Base
                 $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];
index 807ddf0..0fc2887 100644 (file)
@@ -469,7 +469,7 @@ class Horde_Group_Ldap extends Horde_Group
             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']);
         }
 
index 8c99031..1501a37 100644 (file)
@@ -70,7 +70,7 @@ extends Horde_Ldap_Search
      *
      * @return array The resulting array.
      */
-    public function as_struct()
+    public function asArray()
     {
         return $this->_result;
     }
index 89af79a..eeb3f93 100644 (file)
@@ -72,6 +72,6 @@ implements Horde_Kolab_Server_Result_Interface
      */
     public function asArray()
     {
-        return $this->_search->as_struct();
+        return $this->_search->asArray();
     }
 }
\ No newline at end of file
index f9fe70e..ee01adb 100644 (file)
@@ -168,7 +168,7 @@ extends Horde_Kolab_Server_LdapTestCase
                     'dn' => 'cn=d',
                 ),
             ),
-            $a->as_struct()
+            $a->asArray()
         );
 
         $a = $conn->search(null, '(c=3)');
@@ -181,7 +181,7 @@ extends Horde_Kolab_Server_LdapTestCase
                     'dn' => 'cn=c',
                 ),
             ),
-            $a->as_struct()
+            $a->asArray()
         );
 
         $a = $conn->search(null, '(c=3)', array('attributes' => array('a')));
@@ -192,7 +192,7 @@ extends Horde_Kolab_Server_LdapTestCase
                     'dn' => 'cn=c',
                 ),
             ),
-            $a->as_struct()
+            $a->asArray()
         );
 
         $a = $conn->search(null, '(&(a=1)(b=2))', array('attributes' => array('a', 'b')));
@@ -209,7 +209,7 @@ extends Horde_Kolab_Server_LdapTestCase
                     'dn' => 'cn=c',
                 ),
             ),
-            $a->as_struct()
+            $a->asArray()
         );
 
         $a = $conn->search(null, '(|(a=1)(b=2))', array('attributes' => array('a', 'b')));
@@ -236,7 +236,7 @@ extends Horde_Kolab_Server_LdapTestCase
                     'dn' => 'cn=d',
                 )
             ),
-            $a->as_struct()
+            $a->asArray()
         );
 
         $a = $conn->search(null, '(&(b=2))', array('attributes' => array('b')));
@@ -255,7 +255,7 @@ extends Horde_Kolab_Server_LdapTestCase
                     'dn' => 'cn=d',
                 ),
             ),
-            $a->as_struct()
+            $a->asArray()
         );
 
         $a = $conn->search(null, '(!(b=2))', array('attributes' => array('a', 'b')));
@@ -267,7 +267,7 @@ extends Horde_Kolab_Server_LdapTestCase
                     'dn' => 'cn=a',
                 ),
             ),
-            $a->as_struct()
+            $a->asArray()
         );
 
         $a = $conn->search(null, '(&(!(x=2))(b=1))', array('attributes' => array('b')));
@@ -278,13 +278,13 @@ extends Horde_Kolab_Server_LdapTestCase
                     '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 {
@@ -394,7 +394,7 @@ extends Horde_Kolab_Server_LdapTestCase
                       'dn' => 'test'
                   )
             ),
-            $result->as_struct()
+            $result->asArray()
         );
     }
 
@@ -408,7 +408,7 @@ extends Horde_Kolab_Server_LdapTestCase
         $result = $conn->search('test', null, array('scope' => 'base'));
         $this->assertEquals(
             array(),
-            $result->as_struct()
+            $result->asArray()
         );
     }
 
@@ -440,7 +440,7 @@ extends Horde_Kolab_Server_LdapTestCase
                       'dn' => 'test'
                   )
             ),
-            $result->as_struct()
+            $result->asArray()
         );
     }
 
@@ -475,7 +475,7 @@ extends Horde_Kolab_Server_LdapTestCase
         $result = $conn->search('test');
         $this->assertEquals(
             array('test', 'yestest'),
-            array_keys($result->as_struct())
+            array_keys($result->asArray())
         );
     }
 
@@ -522,7 +522,7 @@ extends Horde_Kolab_Server_LdapTestCase
                     'dn' => 'yestest'
                 ),
             ),
-            $result->as_struct()
+            $result->asArray()
         );
     }
 
index 443ae88..fdf06af 100644 (file)
@@ -53,10 +53,10 @@ class Horde_Kolab_Server_Class_Server_Ldap_FilteredTest extends Horde_Kolab_Serv
     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')
index 242be7b..32c98ed 100644 (file)
@@ -52,10 +52,10 @@ class Horde_Kolab_Server_Class_Server_Ldap_StandardTest extends Horde_Kolab_Serv
     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')
index 1fc544a..24b9722 100644 (file)
@@ -50,10 +50,10 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe
     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')
@@ -162,7 +162,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe
     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')
@@ -209,7 +209,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe
     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')
index 78dabec..ec17e5d 100644 (file)
@@ -68,10 +68,10 @@ class Horde_Kolab_Server_Class_Server_Result_LdapTest extends Horde_Kolab_Server
     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());
index fcff699..5fb0865 100644 (file)
@@ -208,7 +208,7 @@ class Search_Mock
         $this->result = $result;
         $this->limit  = $limit;
     }
-    public function as_struct()
+    public function asArray()
     {
         return $this->result;
     }
index 035452d..ced3c6a 100644 (file)
@@ -188,7 +188,7 @@ class Horde_Ldap_Search implements Iterator
      * 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!
@@ -196,7 +196,7 @@ class Horde_Ldap_Search implements Iterator
      * 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
@@ -210,7 +210,7 @@ class Horde_Ldap_Search implements Iterator
      * @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
@@ -240,7 +240,7 @@ class Horde_Ldap_Search implements Iterator
         }
 
         // 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
@@ -293,7 +293,7 @@ class Horde_Ldap_Search implements Iterator
      * 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!
      *
@@ -320,7 +320,7 @@ class Horde_Ldap_Search implements Iterator
     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);
@@ -352,7 +352,7 @@ class Horde_Ldap_Search implements Iterator
      * @return array Associative result array as described above.
      * @throws Horde_Ldap_Exception
      */
-    public function as_struct()
+    public function asArray()
     {
         $return  = array();
         $entries = $this->entries();