toArray(); } if (!is_array($config)) { throw new Exception('Config parameters must be an array or a Zend_Config object'); } if (empty($renderer)) { $renderer = static::getConfig('renderer'); } if (!is_string($renderer) || empty($renderer)) { throw new Exception('Renderer name must be specified in a string'); } $class = 'Qs_Pdf_Renderer_' . ucfirst($renderer); if (!class_exists($class)) { Zend_Loader::loadClass($class); } $instance = new $class($config); if (!$instance instanceof Qs_Pdf_Renderer_RendererInterface) { throw new Exception("Renderer class '{$instance}' does not extend Qs_Pdf_Renderer_Interface"); } return $instance; } public static function getConfig($field = null, $default = null) { if (null === static::$_config) { static::$_config = Qs_Config::get('pdf', Qs_Config::QS_TYPE); } if (null === $field) { return static::$_config; } return static::$_config->get($field, $default); } }