From dc7d96206af1ba4b3578ee046a89109e67f9c14e Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 7 Jun 2010 01:03:53 +0200 Subject: [PATCH] beautified instantiation with ReflectionClass --- lib/model/channel.php | 2 +- lib/model/database.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/model/channel.php b/lib/model/channel.php index cb040d8..ddf998a 100644 --- a/lib/model/channel.php +++ b/lib/model/channel.php @@ -154,7 +154,7 @@ abstract class Channel extends DatabaseObject implements ChannelInterface { final static protected function factory($object) { $rc = new ReflectionClass($object['type']); if (!$rc->isSubclassOf('Channel')) { - throw new InvalidArgumentException('\'' . $object['type'] . '\' is not a valid channel type'); + throw new InvalidArgumentException('\'' . $rc->getName() . '\' is not a valid channel type'); } return $rc->newInstanceArgs(array($object)); diff --git a/lib/model/database.php b/lib/model/database.php index b151d71..b234a90 100644 --- a/lib/model/database.php +++ b/lib/model/database.php @@ -196,7 +196,7 @@ abstract class Database implements DatabaseInterface { $rc = new ReflectionClass($config['db']['backend']); if (!$rc->isSubclassOf('Database')) { - throw new InvalidArgumentException('\'' . $result['type'] . '\' is not a valid database backend'); + throw new InvalidArgumentException('\'' . $rc->getName() . '\' is not a valid database backend'); } self::$connection = $rc->newInstanceArgs(array($config['db']));