/** * [getDsn description]. * * @return [type] [description] */ public function getDsn() { if (!$this->config) { return ''; } $dsn = array(); $path = null; if ($this->config->getName()) { $path = $this->config->getName(); } if ($this->config->getPath()) { $path = $this->config->getPath(); } if ($this->config->getHost()) { if ($this->config->getPort()) { $dsn[] = sprintf('dbname=%s/%s:%s', $this->config->getHost(), $this->config->getPort(), $path); } else { $dsn[] = sprintf('dbname=%s:%s', $this->config->getHost(), $path); } } else { $dsn[] = 'dbname=' . $path; } if ($this->config->getRole()) { $dsn[] = 'role=' . $this->config->getRole(); } if ($this->config->getChar()) { $dsn[] = 'charset=' . $this->config->getChar(); } return $this->getPrefix() . implode(';', $dsn); }
/** * [getDsn description]. * * @return [type] [description] */ public function getDsn() { if (!$this->config) { return ''; } $dsn = array(); $path = null; if ($this->config->getName()) { $path = $this->config->getName(); } if ($this->config->getPath()) { $path = $this->config->getPath(); } if ($path) { if (!file_exists($path)) { @touch($path); } $dsn[] = $path; } else { $dsn[] = ':memory:'; } return $this->getPrefix() . implode(';', $dsn); }
/** * [getDsn description]. * * @return [type] [description] */ public function getDsn() { if (!$this->config) { return ''; } $dsn = array(); if ($this->config->getHost()) { $dsn[] = 'host=' . $this->config->getHost(); } if ($this->config->getPort()) { $dsn[] = 'port=' . $this->config->getPort(); } if ($this->config->getName()) { $dsn[] = 'dbname=' . $this->config->getName(); } if ($this->config->getUser()) { $dsn[] = 'user='******'password='******';', $dsn); }
/** * [getDsn description]. * * @return [type] [description] */ public function getDsn() { if (!$this->config) { return ''; } $dsn = array(); if ($this->config->getSock()) { $dsn[] = 'unix_socket=' . $this->config->getSock(); } if ($this->config->getHost()) { $dsn[] = 'host=' . $this->config->getHost(); } if ($this->config->getPort()) { $dsn[] = 'port=' . $this->config->getPort(); } if ($this->config->getName()) { $dsn[] = 'dbname=' . $this->config->getName(); } if ($this->config->getChar() && in_array('charset', $this->getElements())) { $dsn[] = 'charset=' . $this->config->getChar(); } return $this->getPrefix() . implode(';', $dsn); }
/** * [updateRequest description] * @param [type] $socialiteUser [description] * @return [type] [description] */ protected function updateRequest($socialiteUser) { $this->request->merge(['social_id' => $socialiteUser->getId(), 'email' => $socialiteUser->getEmail(), 'name' => $socialiteUser->getName(), 'avatar' => $socialiteUser->getAvatar(), 'nickname' => $socialiteUser->getNickname(), 'token' => $socialiteUser->token, 'token_secret' => property_exists($socialiteUser, 'tokenSecret') ? $socialiteUser->tokenSecret : null, 'expires_at' => property_exists($socialiteUser, 'expiresIn') ? $socialiteUser->expiresIn : Carbon::parse(config('multiauth.socialite.expires'))]); return $socialiteUser; }
/** * Parse tags for social share sentences * @param [type] $sentence [description] * @param [type] $quiz [description] * @return [type] [description] */ function parse_share_tags_settings($sentence, $quiz) { // same shortcode for user as the one we need on backoffice, so it's useless $sentence = str_replace('%%score%%', '%%score%%', $sentence); $sentence = str_replace('%%personality%%', '%%personality%%', $sentence); // Variables $sentence = str_replace('%%total%%', $quiz->countQuestions(), $sentence); $sentence = str_replace('%%quizname%%', $quiz->getName(), $sentence); $sentence = str_replace('%%quizlink%%', get_permalink(), $sentence); return $sentence; }
/** * 分析方法 * @param [type] $method [description] * @param boolean $docFirst [description] * @return [type] [description] */ static function anaMethod($method, $docFirst = false) { if (!$method->isPublic() || $method->isProtected() || $method->isConstructor() || $method->isDestructor() || $method->isStatic()) { return false; } $name = $method->getName(); if (!$docFirst) { // 先根据方法本身获取最准确的参数情况 $params = $method->getParameters(); $options = array(); foreach ($params as $param) { $name = $param->getName(); $options[$name] = array('name' => $name, 'optional' => $param->isOptional(), 'isArray' => $param->isArray(), 'default' => $param->isDefaultValueAvailable() ? $param->getDefaultValue() : NULL); } $result = self::anaComment($method->getDocComment()); self::_innerAnaMethod($result); foreach ($options as &$option) { if (isset($result['param'][$option['name']])) { $_info = $result['param'][$option['name']]; $option['desc'] = $_info['desc']; $option['type'] = $_info['type']; } else { $option['desc'] = ''; $option['type'] = ''; } } $result['param'] = $options; } else { $result = self::anaComment($method->getDocComment()); self::_innerAnaMethod($result); } if (!isset($result['name'])) { $result['name'] = $method->getName(); } $aMethod = new Miper_Docs_Method(); foreach ($result as $name => $value) { $aMethod->{$name} = $value; } return $aMethod; }