* @return Horde_Kolab_Server_Object|PEAR_Error The newly created concrete
* Horde_Kolab_Server_Object instance.
*/
- public function &factory($type, $uid, &$storage, $data = null)
+ static public function &factory($type, $uid, &$storage, $data = null)
{
$result = Horde_Kolab_Server_Object::loadClass($type);
*
* @return true|PEAR_Error True if successfull.
*/
- public static function loadClass($type)
+ static public function loadClass($type)
{
if (!class_exists($type)) {
throw new Horde_Kolab_Server_Exception('Class definition of ' . $type . ' not found.');
$info[self::ATTRIBUTE_OC] = $this->object_classes;
$result = $this->db->save($this->uid, $info);
- if ($result === false || is_a($result, 'PEAR_Error')) {
+ if ($result === false || $result instanceOf PEAR_Error) {
return $result;
}
$this->db->getBaseUid());
$admin_group = $this->db->fetch($admins_uid, 'Horde_Kolab_Server_Object_group');
- if (is_a($admin_group, 'PEAR_Error') || !$admin_group->exists()) {
+ if ($admin_group instanceOf PEAR_Error || !$admin_group->exists()) {
$members = array($this->uid);
'type' => 'Horde_Kolab_Server_Object_group',
self::ATTRIBUTE_MEMBER => $members,
self::ATTRIBUTE_VISIBILITY => false));
- if (is_a($result, 'PEAR_Error')) {
+ if ($result instanceOf PEAR_Error) {
return $result;
}
} else {
$result = $admin_group->isMember($this->uid);
- if (is_a($result, 'PEAR_Error')) {
+ if ($result instanceOf PEAR_Error) {
return $result;
}
if ($result === false) {
//FIXME: This should be made easier by the group object
$domain_group = $this->db->fetch($domain_uid, 'Horde_Kolab_Server_Object_group');
- if (is_a($domain_group, 'PEAR_Error')) {
+ if ($domain_group instanceOf PEAR_Error) {
return $domain_group;
}
if (!$domain_group->exists()) {
self::ATTRIBUTE_MEMBER => $members));
} else {
$result = $domain_group->isMember($this->uid);
- if (is_a($result, 'PEAR_Error')) {
+ if ($result instanceOf PEAR_Error) {
return $result;
}
if ($result === false) {
*/
public function assertNoError($var)
{
- if (is_a($var, 'Horde_Kolab_Server_Exception')) {
+ if ($var instanceOf Horde_Kolab_Server_Exception) {
$this->assertEquals('', $var->getMessage());
- } else if (is_a($var, 'PEAR_Error')) {
+ } else if ($var instanceOf PEAR_Error) {
$this->assertEquals('', $var->getMessage());
}
}
*/
public function assertError($var, $msg = null)
{
- if (!is_a($var, 'PEAR_Error')) {
+ if (!$var instanceOf PEAR_Error) {
$this->assertType('Horde_Kolab_Server_Exception', $var);
if (isset($msg)) {
$this->assertEquals($msg, $var->getMessage());
*/
public static function suite()
{
+ // Catch strict standards
+ // FIXME: This does not work yet, as we still have a number of
+ // static methods in basic Horde libraries that are not
+ // declared as such.
+ //error_reporting(E_ALL | E_STRICT);
+
$suite = new PHPUnit_Framework_TestSuite('Horde Framework - Kolab_Server');
$basedir = dirname(__FILE__);
'count' => 1)));
$classes = $ldap->getObjectClasses('cn=Gunnar Wrobel,dc=example,dc=org');
- if (is_a($classes, 'PEAR_Error')) {
+ if ($classes instanceOf PEAR_Error) {
$this->assertEquals('', $classes->getMessage());
}
$this->assertContains('top', $classes);