/** * @param IQuarkRESTServiceDescriptor $descriptor * @param string $endpoint * @param string $source */ public function __construct(IQuarkRESTServiceDescriptor $descriptor = null, $endpoint = '', $source = '') { if (func_num_args() == 1) { $endpoint = Quark::WebHost(); } if (strlen(trim($source)) == 0) { $source = QuarkObject::ClassOf($descriptor); } $this->_descriptor = $descriptor; $this->_endpoint = $endpoint; $this->_source = $source; }
/** * @param IQuarkModel $model * * @return string */ private static function _class(IQuarkModel $model) { return strtolower(QuarkObject::ClassOf($model)); }
/** * @param IQuarkModel $model * @param $options * * @return mixed * @throws QuarkArchException */ private function _collection($model, $options) { $collection = isset($options[QuarkModel::OPTION_COLLECTION]) ? $options[QuarkModel::OPTION_COLLECTION] : QuarkObject::ClassOf($model); if ($this->_connection == null) { throw new QuarkArchException('MongoDB connection not pooled'); } return $this->_connection->{$collection}; }