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


PHP Profile::getToken方法代码示例

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


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

示例1: save

 /**
  * @param Profile $profile
  */
 public function save(Profile $profile)
 {
     $dto = new ProfileDto();
     $dto->token = $profile->getToken();
     $dto->serialized = base64_encode(serialize($profile));
     $this->entityManager->persist($dto);
     $this->entityManager->flush();
 }
开发者ID:sroze,项目名称:profile,代码行数:11,代码来源:DoctrineProfileRepository.php

示例2: write

 /**
  * {@inheritdoc}
  */
 public function write(Profile $profile)
 {
     $args = ['token' => $profile->getToken(), 'parent' => $profile->getParentToken(), 'data' => base64_encode(serialize($profile->getCollectors())), 'ip' => $profile->getIp(), 'method' => $profile->getMethod(), 'url' => $profile->getUrl(), 'time' => $profile->getTime(), 'created_at' => time()];
     try {
         $query = $this->database->select('webprofiler', 'w')->fields('w', ['token']);
         $query->condition('token', $profile->getToken());
         $count = $query->countQuery()->execute()->fetchAssoc();
         if ($count['expression']) {
             $this->database->update('webprofiler')->fields($args)->condition('token', $profile->getToken())->execute();
         } else {
             $this->database->insert('webprofiler')->fields($args)->execute();
         }
         $status = TRUE;
     } catch (\Exception $e) {
         $status = FALSE;
     }
     return $status;
 }
开发者ID:ABaldwinHunter,项目名称:durhamatletico-cms,代码行数:21,代码来源:DatabaseProfilerStorage.php

示例3: getQuery

 /**
  * @param $profile ->getToken()
  * @param int $qid
  *
  * @return array
  */
 private function getQuery(Profile $profile, $qid)
 {
     $this->profiler->disable();
     $token = $profile->getToken();
     if (!($profile = $this->profiler->loadProfile($token))) {
         throw new NotFoundHttpException($this->t('Token @token does not exist.', ['@token' => $token]));
     }
     /** @var DatabaseDataCollector $databaseCollector */
     $databaseCollector = $profile->getCollector('database');
     $queries = $databaseCollector->getQueries();
     $query = $queries[$qid];
     return $query;
 }
开发者ID:ABaldwinHunter,项目名称:durhamatletico-cms,代码行数:19,代码来源:DatabaseController.php

示例4: write

 /**
  * {@inheritdoc}
  */
 public function write(Profile $profile)
 {
     $db = $this->initDb();
     $args = array(':token' => $profile->getToken(), ':parent' => $profile->getParent() ? $profile->getParent()->getToken() : '', ':data' => base64_encode(serialize($profile->getCollectors())), ':ip' => $profile->getIp(), ':url' => $profile->getUrl(), ':time' => $profile->getTime(), ':created_at' => time());
     try {
         $this->exec($db, 'INSERT INTO sf_profiler_data (token, parent, data, ip, url, time, created_at) VALUES (:token, :parent, :data, :ip, :url, :time, :created_at)', $args);
         $this->cleanup();
         $status = true;
     } catch (\Exception $e) {
         $status = false;
     }
     $this->close($db);
     return $status;
 }
开发者ID:robertowest,项目名称:CuteFlow-V4,代码行数:17,代码来源:PdoProfilerStorage.php

示例5: saveStopwatchInfoInProfile

 /**
  * Update the profiles with the timing info and saves them.
  *
  * @param Profile $profile        The root profile
  * @param Boolean $updateChildren Whether to update the children altogether
  */
 private function saveStopwatchInfoInProfile(Profile $profile, $updateChildren)
 {
     $profile->getCollector('time')->setEvents($this->stopwatch->getSectionEvents($profile->getToken()));
     $this->profiler->saveProfile($profile);
     if ($updateChildren) {
         foreach ($profile->getChildren() as $child) {
             $this->saveStopwatchInfoInProfile($child, true);
         }
     }
 }
开发者ID:laubosslink,项目名称:lab,代码行数:16,代码来源:ContainerAwareTraceableEventDispatcher.php

示例6: saveInfoInProfile

 /**
  * Update the profiles with the timing and events information and saves them.
  *
  * @param Profile $profile        The root profile
  * @param Boolean $updateChildren Whether to update the children altogether
  */
 private function saveInfoInProfile(Profile $profile, $updateChildren)
 {
     try {
         $collector = $profile->getCollector('memory');
         $collector->updateMemoryUsage();
     } catch (\InvalidArgumentException $e) {
     }
     try {
         $collector = $profile->getCollector('time');
         $collector->setEvents($this->stopwatch->getSectionEvents($profile->getToken()));
     } catch (\InvalidArgumentException $e) {
     }
     try {
         $collector = $profile->getCollector('events');
         $collector->setCalledListeners($this->getCalledListeners());
         $collector->setNotCalledListeners($this->getNotCalledListeners());
     } catch (\InvalidArgumentException $e) {
     }
     $this->profiler->saveProfile($profile);
     if ($updateChildren) {
         foreach ($profile->getChildren() as $child) {
             $this->saveInfoInProfile($child, true);
         }
     }
 }
开发者ID:ronnylt,项目名称:symfony,代码行数:31,代码来源:TraceableEventDispatcher.php

示例7: write

 /**
  * {@inheritdoc}
  */
 public function write(Profile $profile)
 {
     $data = array('token' => $profile->getToken(), 'parent' => $profile->getParentToken(), 'children' => array_map(function ($p) {
         return $p->getToken();
     }, $profile->getChildren()), 'data' => $profile->getCollectors(), 'ip' => $profile->getIp(), 'method' => $profile->getMethod(), 'url' => $profile->getUrl(), 'time' => $profile->getTime());
     if ($this->setValue($this->getItemName($profile->getToken()), $data, $this->lifetime, self::REDIS_SERIALIZER_PHP)) {
         // Add to index
         $indexName = $this->getIndexName();
         $indexRow = implode("\t", array($profile->getToken(), $profile->getIp(), $profile->getMethod(), $profile->getUrl(), $profile->getTime(), $profile->getParentToken())) . "\n";
         return $this->appendValue($indexName, $indexRow, $this->lifetime);
     }
     return false;
 }
开发者ID:rikaix,项目名称:symfony,代码行数:16,代码来源:RedisProfilerStorage.php

示例8: collect

 /**
  * Collects data for the given Response.
  *
  * @param Request    $request   A Request instance
  * @param Response   $response  A Response instance
  * @param \Exception $exception An exception instance if the request threw one
  *
  * @return Profile|null A Profile instance or null if the profiler is disabled
  */
 public function collect(Request $request, Response $response, \Exception $exception = null)
 {
     if (false === $this->enabled) {
         return;
     }
     $profile = new Profile(substr(sha1(uniqid(mt_rand(), true)), 0, 6));
     $profile->setTime(time());
     $profile->setUrl($request->getUri());
     $profile->setIp($request->getClientIp());
     $profile->setMethod($request->getMethod());
     $response->headers->set('X-Debug-Token', $profile->getToken());
     foreach ($this->collectors as $collector) {
         $collector->collect($request, $response, $exception);
         // forces collectors to become "read/only" (they loose their object dependencies)
         $profile->addCollector(unserialize(serialize($collector)));
     }
     return $profile;
 }
开发者ID:marchyoung,项目名称:FrameworkBenchmarks,代码行数:27,代码来源:Profiler.php

示例9: collect

 /**
  * Collects data for the given Response.
  *
  * @param Request    $request   A Request instance
  * @param Response   $response  A Response instance
  * @param \Exception $exception An exception instance if the request threw one
  *
  * @return Profile|null A Profile instance or null if the profiler is disabled
  */
 public function collect(Request $request, Response $response, \Exception $exception = null)
 {
     if (false === $this->enabled) {
         return;
     }
     $profile = new Profile(substr(hash('sha256', uniqid(mt_rand(), true)), 0, 6));
     $profile->setTime(time());
     $profile->setUrl($request->getUri());
     $profile->setIp($request->getClientIp());
     $profile->setMethod($request->getMethod());
     $profile->setStatusCode($response->getStatusCode());
     $response->headers->set('X-Debug-Token', $profile->getToken());
     foreach ($this->collectors as $collector) {
         $collector->collect($request, $response, $exception);
         // we need to clone for sub-requests
         $profile->addCollector(clone $collector);
     }
     return $profile;
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:28,代码来源:Profiler.php

示例10: getParentToken

 /**
  * Returns the parent token.
  *
  * @return null|string The parent token
  */
 public function getParentToken()
 {
     return $this->parent ? $this->parent->getToken() : null;
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:9,代码来源:Profile.php

示例11: collect

 /**
  * Collects data for the given Response.
  *
  * @param Request    $request   A Request instance
  * @param Response   $response  A Response instance
  * @param \Exception $exception An exception instance if the request threw one
  *
  * @return Profile|false A Profile instance or false if the profiler is disabled
  */
 public function collect(Request $request, Response $response, \Exception $exception = null)
 {
     if (false === $this->enabled) {
         return;
     }
     $profile = new Profile(uniqid());
     $profile->setTime(time());
     $profile->setUrl($request->getUri());
     $profile->setIp($request->server->get('REMOTE_ADDR'));
     $response->headers->set('X-Debug-Token', $profile->getToken());
     $collectors = array();
     foreach ($this->collectors as $name => $collector) {
         $collector->collect($request, $response, $exception);
         // forces collectors to become "read/only" (they loose their object dependencies)
         $profile->addCollector(unserialize(serialize($collector)));
     }
     return $profile;
 }
开发者ID:robertowest,项目名称:CuteFlow-V4,代码行数:27,代码来源:Profiler.php


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