当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::getId方法代码示例

本文整理汇总了PHP中Client::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::getId方法的具体用法?PHP Client::getId怎么用?PHP Client::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Client的用法示例。


在下文中一共展示了Client::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _checkUser

 protected function _checkUser()
 {
     if (fnGet($this->input, 'access_token') == '') {
         $this->_ajaxReturn(array('error_code' => '600020', 'error_msg' => '参数[access_token]不能为空'), 400);
     }
     // 设置当前用户和客户端
     $this->session->setUser($user = new User())->setClient($client = new Client());
     $passportConfig = $this->config->get("api.passport");
     // 尝试从缓存获取 userInfo
     if ($this->_userInfo = S($cacheKey = 'access_token_info.' . fnGet($this->input, 'access_token'))) {
         $user->find(fnGet($this->_userInfo, 'user_id'));
         $client->find(fnGet($this->_userInfo, 'client_id'));
         return;
     }
     // 向 passport 请求 userInfo
     $time = time();
     $url = str_replace('internal-resource/user-info?', '', $passportConfig->passportUrl) . 'internal-resource/user-info';
     $params = array('access_token' => fnGet($this->input, 'access_token'), 'app' => $passportConfig->passportApp, 'time' => $time);
     $sign = md5(implode('', $params) . $passportConfig->passportSecret);
     $params['sign'] = $sign;
     $http = new HttpClient();
     $response = $http->request($url, $params);
     $data = json_decode($response, true);
     if (fnGet($data, 'id')) {
         //检测用户是否已经保存
         $user->getByUsername($username = fnGet($data, 'username'));
         if (!($userId = $user->getId()) || !$user->getData('passport_id') || $user->getData('mobile') != fnGet($data, 'mobile')) {
             $user->addData(array('username' => $username, 'email' => fnGet($data, 'email'), 'mobile' => fnGet($data, 'mobile'), 'passport_id' => fnGet($data, 'passport_id'), 'avatar' => fnGet($data, 'avatar'), 'nickname' => fnGet($data, 'nickname')));
             $user->save();
             $userId = $user->getId();
         }
         //检测客户端是否已经保存
         $client->getByAppId($appId = fnGet($data, 'client_info/id'));
         if (!($clientId = $client->getId()) || $client->getScopes() != fnGet($data, 'client_info/scopes')) {
             $client->addData(array('client' => $appId, 'name' => fnGet($data, 'client_info/name'), 'app_secret' => fnGet($data, 'client_info/secret'), 'developerurl' => fnGet($data, 'client_info/endpoint'), 'scopes' => fnGet($data, 'client_info/scopes')));
             $client->save();
             $clientId = $client->getId();
         }
         $this->_userInfo = array('user_id' => $userId, 'client_id' => $clientId, 'username' => $username, 'session_data' => fnGet($data, 'session_data'));
         S($cacheKey, $this->_userInfo, 3600);
         return;
     }
     $this->_ajaxReturn(array('error_code' => '600020', 'error_msg' => '用户无效'), 400);
 }
开发者ID:xinson,项目名称:yafPlus,代码行数:44,代码来源:Base.php

示例2: updateClient

 /**
  * update the client using the client values
  *
  * @param Client $client        	
  * @return void
  */
 public function updateClient($client)
 {
     try {
         $tmp = $this->getClientById($client->getId());
         clientDaoImp::updateState($tmp, $client);
         $this->entityManager->persist($tmp);
         // $this->entityManager->flush();
     } catch (Exception $ex) {
         "ClientDaoImp-update(): " . $ex->getTrace();
     }
 }
开发者ID:AngersPhoenix,项目名称:ReadingFun,代码行数:17,代码来源:ClientDaoImp.php

示例3: remove

 /**
  * Removes the client from the "clients" and the "requests"
  * array.
  *
  * @param AlphaRPC\Manager\ClientHandler\Client $client
  *
  * @return \AlphaRPC\Manager\ClientHandler\ClientBucket
  */
 public function remove(Client $client)
 {
     $clientId = $client->getId();
     if (!isset($this->clients[$clientId])) {
         return $this;
     }
     $requestId = $client->getRequest();
     $this->removeClientForRequest($clientId, $requestId);
     unset($this->clients[$clientId]);
     return $this;
 }
开发者ID:olivier1980,项目名称:alpharpc,代码行数:19,代码来源:ClientBucket.php

示例4: Client

 function test_getId()
 {
     //Arrange
     $client_name = "Ted";
     $stylist_id = 1;
     $id = 1;
     $test_client = new Client($client_name, $id);
     //Act
     $result = $test_client->getId();
     //Assert
     $this->assertEquals(true, is_numeric($result));
 }
开发者ID:jtorrespdx,项目名称:hair_salon,代码行数:12,代码来源:ClientTest.php

示例5: Stylist

 function test_getId()
 {
     $name = "Jane Doe";
     $test_stylist = new Stylist($name);
     $test_stylist->save();
     $client_name = "Jimmy";
     $id = 1;
     $client_stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $client_stylist_id, $id);
     $result = $test_client->getId();
     $this->assertEquals($id, $result);
 }
开发者ID:juliocesardiaz,项目名称:HairSalon,代码行数:12,代码来源:ClientTest.php

示例6: Stylist

 function test_getId()
 {
     $name = "Megan";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $client_name = "Shawnee";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $id, $stylist_id);
     $test_client->save();
     $result = $test_client->getId();
     $this->assertEquals(true, is_numeric($result));
 }
开发者ID:jschold,项目名称:Hair_Salon,代码行数:13,代码来源:ClientTest.php

示例7: updateClient

 /**
  *
  * @param Client $client
  * @return type
  * @throws DaoException 
  */
 public function updateClient(Client $client)
 {
     try {
         $query = Doctrine_Query::create()->update('Client i');
         $query->set('i.name', '?', $client->getName());
         $query->set('i.address', '?', $client->getAddress());
         $query->set('i.tp_hp', '?', $client->getTpHp());
         $query->set('i.tp_home', '?', $client->getTpHome());
         $query->set('i.notes', '?', $client->getNotes());
         $query->where('i.id = ?', $client->getId());
         return $query->execute();
     } catch (Exception $e) {
         throw new DaoException($e->getMessage(), $e->getCode(), $e);
     }
 }
开发者ID:GarraouiMarwen,项目名称:open-stock-management,代码行数:21,代码来源:ClientDao.php

示例8: Stylist

 function test_getId()
 {
     //Arrange
     $name = "Sasha";
     $id = 1;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $c_name = "Garry Gergich";
     $phone = "503-472-8959";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($c_name, $phone, $id, $stylist_id);
     //Act
     $result = $test_client->getId();
     //Assert
     $this->assertEquals(true, is_numeric($result));
 }
开发者ID:jcubed22,项目名称:Hair_SalonSQL,代码行数:16,代码来源:ClientTest.php

示例9: testFind

 function testFind()
 {
     //Arrange
     $id = null;
     $client_name = "Nico";
     $stylist_id = 1;
     $test_client = new Client($id, $client_name, $stylist_id);
     $test_client->save();
     $client_name2 = "Al";
     $stylist_id2 = 2;
     $test_client2 = new Client($id, $client_name2, $stylist_id2);
     $test_client2->save();
     //Act
     $result = Client::find($test_client->getId());
     //Assert
     $this->assertEquals($test_client, $result);
 }
开发者ID:austinblanchard,项目名称:hair_salon,代码行数:17,代码来源:ClientTest.php

示例10: Stylist

 function test_client_find()
 {
     //Arrange
     $name = "Vidal Sassoon";
     $test_stylist = new Stylist($name);
     $test_stylist->save();
     $name2 = "Sweeney Todd";
     $test_stylist2 = new Stylist($name2);
     $test_stylist2->save();
     $name3 = "Mr. T";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($name3, $stylist_id, null);
     $test_client->save();
     $name4 = "Mrs. T";
     $stylist_id2 = $test_stylist2->getId();
     $test_client2 = new Client($name4, $stylist_id2, null);
     $test_client2->save();
     //Act
     $result = Client::find($test_client->getId());
     //Assert
     $this->assertEquals($test_client, $result);
 }
开发者ID:CharlesAMoss,项目名称:epic_HairSalon,代码行数:22,代码来源:ClientTest.php

示例11: testSetGet

 public function testSetGet()
 {
     $client = new Client();
     $id = 'test_id';
     $client->setId($id);
     $this->assertEquals($id, $client->getId(), 'Unable to setup id!');
     $name = 'test_name';
     $client->setName($name);
     $this->assertEquals($name, $client->getName(), 'Unable to setup name!');
     $title = 'test_title';
     $client->setTitle($title);
     $this->assertEquals($title, $client->getTitle(), 'Unable to setup title!');
     $userAttributes = ['attribute1' => 'value1', 'attribute2' => 'value2'];
     $client->setUserAttributes($userAttributes);
     $this->assertEquals($userAttributes, $client->getUserAttributes(), 'Unable to setup user attributes!');
     $normalizeUserAttributeMap = ['name' => 'some/name', 'email' => 'some/email'];
     $client->setNormalizeUserAttributeMap($normalizeUserAttributeMap);
     $this->assertEquals($normalizeUserAttributeMap, $client->getNormalizeUserAttributeMap(), 'Unable to setup normalize user attribute map!');
     $viewOptions = ['option1' => 'value1', 'option2' => 'value2'];
     $client->setViewOptions($viewOptions);
     $this->assertEquals($viewOptions, $client->getViewOptions(), 'Unable to setup view options!');
 }
开发者ID:aivavic,项目名称:yii2,代码行数:22,代码来源:BaseClientTest.php

示例12: addClient

 public function addClient(Client $client)
 {
     return $this->storage->execute('INSERT INTO client(id,secret,name,redirect_url,user_id,description) VALUES ("' . $client->getId() . '" , "' . $client->getSecret() . '" ,"' . $client->getName() . '" ,"' . $client->getRedirectUrl() . '" ,"' . $client->getUserId() . '","' . $client->getDescription() . '")');
 }
开发者ID:nguereza-tony,项目名称:oauth2,代码行数:4,代码来源:Server.php

示例13: Order

?>
			<input type="submit" value="Complete" onClick="setCompleted()">
			<?php 
//}
?>
			<hr>
			<table>
				<tr><td style="width:200px;">Order Code</td>
					<td style="width:200px;">Title</td>
					<td style="width:200px;">Client</td>
					<td style="width:200px;">Destination</td>
					<td style="width:200px;">Action</td>
				</tr>
				<?php 
for ($i = 0; $i < sizeof($orderList); $i++) {
    $mOrder = new Order($orderList[$i]);
    $mClient = new Client($mOrder->getClient());
    echo "<tr>";
    echo "<td><a href='../order/detail.php?id=" . $mOrder->getId() . "'>" . $mOrder->getCode() . "</a></td>";
    echo "<td>" . $mOrder->getTitle() . "</td>";
    echo "<td><a href='../client/detail.php?id=" . $mClient->getId() . "'>" . $mClient->getName() . "</a></td>";
    echo "<td>" . $mOrder->getDestination() . "</td>";
    echo "<td><input type='submit' value='Assign'><input type='submit' value='Track'></td>";
    echo "</tr>";
}
?>
			</table>
		<div>
	</div>
	
</body> 
开发者ID:rustydev19,项目名称:Navigator,代码行数:31,代码来源:detail.php

示例14: Stylist

 function test_find()
 {
     //Arrange
     $name = "Tessa";
     $id = null;
     $visits = 4;
     $description = "The best!";
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $name = "jack";
     $name2 = "Bob";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($name, $stylist_id, $id, $visits, $description);
     $test_client->save();
     $test_client2 = new Client($name, $stylist_id, $id, $visits, $description);
     $test_client2->save();
     //Act
     $result = Client::find($test_client->getId());
     //Assert
     $this->assertEquals($test_client, $result);
 }
开发者ID:alexMcosta,项目名称:Salon_Assesment,代码行数:21,代码来源:ClientTest.php

示例15: runScript

 /**
  * Runs a client level pre or post script.
  *
  * @param  string   $type       Either "pre" or "post".
  *
  * @param  int      $status     Status of previos command.
  *
  * @param  Client   $client     Client entity
  *
  * @param  Job      $job        Job entity. Null if running at the client level.
  *
  * @param  Script   $script     Script entity
  *
  * @param  string   $stats      Stats for script environment vars (not stored in DB)
  *
  * @return boolean  true on success, false on error.
  *
  */
 protected function runScript($type, $status, $client, $job, $script, $stats)
 {
     if ($script === null) {
         return true;
     }
     if (null == $job) {
         $entity = $client;
         $context = array('link' => $this->generateClientRoute($client->getId()));
         $errScriptError = 'Client "%entityid%" %scripttype% script "%scriptname%" execution failed. Diagnostic information follows: %output%';
         $errScriptMissing = 'Client "%entityid%" %scripttype% script "%scriptname%" present but file "%scriptfile%" missing.';
         $errScriptOk = 'Client "%entityid%" %scripttype% script "%scriptname%" execution succeeded. Output follows: %output%';
         $level = 'CLIENT';
         // Empty vars (only available under JOB level)
         $job_name = '';
         $owner_email = '';
         $recipient_list = '';
         $job_total_size = 0;
         $job_run_size = 0;
         $job_starttime = 0;
         $job_endtime = 0;
         if ($type == 'post') {
             $client_endtime = $stats['ELKARBACKUP_CLIENT_ENDTIME'];
             $client_starttime = $stats['ELKARBACKUP_CLIENT_STARTTIME'];
         } else {
             $client_endtime = 0;
             $client_starttime = 0;
         }
     } else {
         $entity = $job;
         $context = array('link' => $this->generateJobRoute($job->getId(), $client->getId()));
         $errScriptError = 'Job "%entityid%" %scripttype% script "%scriptname%" execution failed. Diagnostic information follows: %output%';
         $errScriptMissing = 'Job "%entityid%" %scripttype% script "%scriptname%" present but file "%scriptfile%" missing.';
         $errScriptOk = 'Job "%entityid%" %scripttype% script "%scriptname%" execution succeeded. Output follows: %output%';
         $level = 'JOB';
         $job_name = $job->getName();
         $owner_email = $job->getOwner()->getEmail();
         $recipient_list = $job->getNotificationsEmail();
         $job_total_size = $job->getDiskUsage();
         $client_starttime = 0;
         $client_endtime = 0;
         if ($type == 'post') {
             $job_run_size = $stats['ELKARBACKUP_JOB_RUN_SIZE'];
             $job_starttime = $stats['ELKARBACKUP_JOB_STARTTIME'];
             $job_endtime = $stats['ELKARBACKUP_JOB_ENDTIME'];
         } else {
             $job_run_size = 0;
             $job_starttime = 0;
             $job_endtime = 0;
         }
     }
     $scriptName = $script->getName();
     $scriptFile = $script->getScriptPath();
     if (!file_exists($scriptFile)) {
         $this->err($errScriptMissing, array('%entityid%' => $entity->getId(), '%scriptfile%' => $scriptFile, '%scriptname%' => $scriptName, '%scripttype%' => $type), $context);
         return false;
     }
     $commandOutput = array();
     $command = sprintf('env ELKARBACKUP_LEVEL="%s" ELKARBACKUP_EVENT="%s" ELKARBACKUP_URL="%s" ELKARBACKUP_ID="%s" ELKARBACKUP_PATH="%s" ELKARBACKUP_STATUS="%s" ELKARBACKUP_CLIENT_NAME="%s" ELKARBACKUP_JOB_NAME="%s" ELKARBACKUP_OWNER_EMAIL="%s" ELKARBACKUP_RECIPIENT_LIST="%s" ELKARBACKUP_CLIENT_TOTAL_SIZE="%s" ELKARBACKUP_JOB_TOTAL_SIZE="%s" ELKARBACKUP_JOB_RUN_SIZE="%s" ELKARBACKUP_CLIENT_STARTTIME="%s" ELKARBACKUP_CLIENT_ENDTIME="%s" ELKARBACKUP_JOB_STARTTIME="%s" ELKARBACKUP_JOB_ENDTIME="%s" sudo "%s" 2>&1', $level, 'pre' == $type ? 'PRE' : 'POST', $entity->getUrl(), $entity->getId(), $entity->getSnapshotRoot(), $status, $client->getName(), $job_name, $owner_email, $recipient_list, $client->getDiskUsage(), $job_total_size, $job_run_size, $client_starttime, $client_endtime, $job_starttime, $job_endtime, $scriptFile);
     exec($command, $commandOutput, $status);
     if (0 != $status) {
         $this->err($errScriptError, array('%entityid%' => $entity->getId(), '%output%' => "\n" . implode("\n", $commandOutput), '%scriptname%' => $scriptName, '%scripttype%' => $type), $context);
         return false;
     }
     $this->info($errScriptOk, array('%entityid%' => $entity->getId(), '%output%' => "\n" . implode("\n", $commandOutput), '%scriptname%' => $scriptName, '%scripttype%' => $type), $context);
     return true;
 }
开发者ID:hagish,项目名称:elkarbackup,代码行数:84,代码来源:BackupRunningCommand.php


注:本文中的Client::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。