當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Service::isDebug方法代碼示例

本文整理匯總了PHP中Service::isDebug方法的典型用法代碼示例。如果您正苦於以下問題:PHP Service::isDebug方法的具體用法?PHP Service::isDebug怎麽用?PHP Service::isDebug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Service的用法示例。


在下文中一共展示了Service::isDebug方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: logCacheFetch

 /**
  * Log a cache fetch in the data collector
  * @param string $type The type of the fetched model
  * @param int    $id   The ID of the fetched model
  */
 public static function logCacheFetch($type, $id)
 {
     if (\Service::isDebug() && \Service::getContainer()) {
         $collector = \Service::getContainer()->get('data_collector.bzion_database_collector', null);
         if ($collector) {
             $collector->logCacheFetch($type, $id);
         }
     }
 }
開發者ID:blast007,項目名稱:bzion,代碼行數:14,代碼來源:Debug.php

示例2: build

 /**
  * {@inheritDoc}
  */
 protected function build($builder)
 {
     $emailConstraints = array(new Length(array('max' => 255)));
     if (!\Service::isDebug()) {
         // Don't validate e-mails when developing, for example to allow
         // messaging anyone@localhost
         $emailConstraints[] = new Email();
     }
     $builder->add('description', 'textarea', array('constraints' => new Length(array('max' => 8000)), 'data' => $this->editing->getDescription(), 'required' => false))->add('avatar', 'file', array('constraints' => new Image(array('minWidth' => 50, 'minHeight' => 50, 'maxSize' => '4M')), 'required' => false))->add('delete_avatar', 'submit')->add('country', 'choice', array('choices' => \Country::getCountriesWithISO(), 'data' => $this->editing->getCountry()->getISO(), 'required' => false))->add('email', 'email', array('constraints' => $emailConstraints, 'data' => $this->editing->getEmailAddress(), 'label' => 'E-Mail Address', 'required' => false))->add('receive', 'choice', array('choices' => array('nothing' => 'Nothing', 'messages' => 'Messages only', 'everything' => 'Everything'), 'data' => $this->editing->getReceives(), 'label' => 'Receive notifications about', 'expanded' => true, 'placeholder' => false, 'required' => false))->add('timezone', new TimezoneType($this->editing->getTimezone()), array('constraints' => new NotBlank(), 'data' => $this->editing->getTimezone()))->add('enter', 'submit');
     $address = $this->editing->getEmailAddress();
     if (!$this->editingSelf && !empty($address) && !$this->editing->isVerified()) {
         // Show a button to verify an unverified user's e-mail address to
         // admins
         $builder->add('verify_email', 'submit', array('attr' => array('class' => 'c-button--grey'), 'label' => 'Verify E-Mail address'));
     }
     return $builder;
 }
開發者ID:kleitz,項目名稱:bzion,代碼行數:20,代碼來源:ProfileFormCreator.php

示例3: finish

 /**
  * Mark a query as finished
  *
  * @param  mixed $return The returned values of the query
  * @return void
  */
 public function finish(&$return)
 {
     $duration = Debug::finishStopwatch($this->eventName);
     Debug::log("Database {$this->queryType} query", array("query" => $this->query, "params" => $this->params, "duration" => "{$duration} ms"), 'mysql');
     if (\Service::isDebug()) {
         $this->finishTime = microtime(true);
         $this->duration = ($this->finishTime - $this->startTime) * self::MICROSECONDS_IN_SECOND;
         $this->results = $return;
         $collector = \Service::getContainer()->get('data_collector.bzion_database_collector', null);
         if ($collector) {
             $collector->logQuery($this);
         }
     }
 }
開發者ID:kleitz,項目名稱:bzion,代碼行數:20,代碼來源:DatabaseQuery.php


注:本文中的Service::isDebug方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。