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


PHP Profile::stop方法代码示例

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


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

示例1: getService

 /**
  * Gets a service.
  *
  * @param  string $id The service identifier
  *
  * @return object The associated service
  *
  * @throw InvalidArgumentException if the service is not defined
  * @throw LogicException if the service has a circular reference to itself
  */
 public function getService($id)
 {
     Profile::start('SymfonyContainer', 'Getting service');
     try {
         $return = parent::getService($id);
     } catch (InvalidArgumentException $e) {
         if (isset($this->loading[$id])) {
             Profile::stop();
             throw new LogicException(sprintf('The service "%s" has a circular reference to itself.', $id));
         }
         if (!$this->hasServiceDefinition($id) && isset($this->aliases[$id])) {
             $return = $this->getService($this->aliases[$id]);
         } else {
             $definition = $this->getServiceDefinition($id);
             $this->loading[$id] = true;
             if ($definition->isShared()) {
                 $service = $this->services[$id] = $this->createService($definition);
             } else {
                 $service = $this->createService($definition);
             }
             unset($this->loading[$id]);
             $return = $service;
         }
     }
     Profile::stop();
     return $return;
 }
开发者ID:enyo,项目名称:rincewind,代码行数:37,代码来源:sfServiceContainerBuilder.php

示例2: testProfile

 public function testProfile()
 {
     $p = new Profile();
     $p->start('foo');
     $p->start('bar');
     $p->start('foo');
     $p->stop();
     // stop foo 2
     $p->stop();
     // stop bar
     $p->start('che');
     $p->stop();
     // stop che 1
     $p->stop();
     // stop foo 1
     $map = $p->get();
     $this->assertTrue(isset($map['foo']['children']['bar']['children']['foo']));
     $this->assertTrue(isset($map['foo']['children']['che']));
 }
开发者ID:Jaymon,项目名称:Montage,代码行数:19,代码来源:ProfileTest.php

示例3: render

 /**
  * {@inheritdoc}
  */
 public function render($viewName, Model $model, NotificationCenter $notificationCenter, $output = true)
 {
     Profile::start('Renderer', 'Generate HTML');
     $filename = $this->templatesPath . $viewName . '.' . static::$templateFileExtension;
     if ($output) {
         $html = null;
         readfile($filename);
     } else {
         $html = file_get_contents($filename);
     }
     Profile::stop();
     return $html;
 }
开发者ID:enyo,项目名称:rincewind,代码行数:16,代码来源:HtmlRenderer.php

示例4: load

 /**
  * Loads and caches the config files
  */
 public function load()
 {
     if ($this->config) {
         return;
     }
     Profile::start('IniFileConfig', 'Load');
     if ($this->defaultConfigFileUri) {
         $this->config = $this->mergeConfigArrays(parse_ini_file($this->defaultConfigFileUri, $this->useSections), parse_ini_file($this->configFileUri, $this->useSections));
     } else {
         $this->config = parse_ini_file($this->configFileUri, $this->useSections);
     }
     Profile::stop();
 }
开发者ID:enyo,项目名称:rincewind,代码行数:16,代码来源:IniFileConfig.php

示例5: next

 public function next()
 {
     Profile::start(__METHOD__);
     parent::next();
     $this->_stepInOut = 0;
     $this->_stepFirst = false;
     while (count($this->_stack) > 0 && $this->_stack[0] < $this->_current_model->rside) {
         array_shift($this->_stack);
         $this->_stepInOut--;
     }
     if ($this->_stack[0] != $this->_current_model->rside) {
         array_splice($this->_path, count($this->_path) + $this->_stepInOut++, count($this->_path), (string) $this->_current_model);
         array_unshift($this->_stack, $this->_current_model->rside);
     }
     Profile::stop(__METHOD__);
 }
开发者ID:kstep,项目名称:pnut,代码行数:16,代码来源:TraversedTree.php

示例6: render

 /**
  * {@inheritdoc}
  */
 public function render($viewName, Model $model, NotificationCenter $notificationCenter, $output = true)
 {
     Profile::start('Renderer', 'Generate JSON');
     if (strpos($viewName, 'errors/') === 0) {
         $data = array('error' => substr($viewName, strlen('errors/')));
     } else {
         $c = $model->getData(Model::PUBLISHABLE);
         $data = array('content' => count($c) === 0 ? null : $c);
     }
     if (count($notificationCenter->getErrors())) {
         $data['errorMessages'] = $notificationCenter->getErrors();
     }
     if (count($notificationCenter->getSuccesses())) {
         $data['successMessages'] = $notificationCenter->getSuccesses();
     }
     $json = json_encode($data);
     $this->setHeader('Content-type: application/json', $output);
     if ($output) {
         echo $json;
     }
     Profile::stop();
     return $output ? null : $json;
 }
开发者ID:enyo,项目名称:rincewind,代码行数:26,代码来源:JsonRenderer.php

示例7: render

 /**
  * {@inheritdoc}
  */
 public function render($viewName, Model $model, NotificationCenter $notificationCenter, $output = true)
 {
     Profile::start('Renderer', 'Rendering HTML');
     $templateName = $viewName . '.' . static::$templateFileExtension;
     $loader = new Twig_Loader_Filesystem($this->templatesPath);
     $twig = new Twig_Environment($loader, array('cache' => $this->cachePath));
     foreach ($this->extensions as $extension) {
         $twig->addExtension($extension);
     }
     foreach ($this->globals as $name => $global) {
         $twig->addGlobal($name, $global);
     }
     $twig->addGlobal('notifications', $notificationCenter);
     //    $twig->addGlobal('controller', $);
     $this->setHeader('Content-type: text/html', $output);
     $result = $twig->render($templateName, $model->getData());
     if ($output) {
         echo $result;
     }
     Profile::stop();
     return $output ? null : $rendered;
 }
开发者ID:enyo,项目名称:rincewind,代码行数:25,代码来源:TwigRenderer.php

示例8: testStop

 /**
  * @covers Profile::stop
  */
 public function testStop()
 {
     $this->profiler->expects($this->once())->method('stop');
     Profile::stop();
 }
开发者ID:enyo,项目名称:rincewind,代码行数:8,代码来源:ProfileTest.php

示例9: dispatch


//.........这里部分代码省略.........
         try {
             if ($invalidControllerName) {
                 ErrorCode::notFound();
             }
             try {
                 $errorDuringRender = null;
                 $errorCode = null;
                 // Try to dispatch to the actual action.
                 $actionParameters = explode('/', isset($_GET['action']) ? $_GET['action'] : 'index');
                 $action = $actionParameters[0];
                 array_shift($actionParameters);
                 if ($action[0] === '_') {
                     throw new ErrorCode(ErrorCode::NOT_FOUND, 'Tried to access action with underscore.');
                 }
                 $action = $this->actionFromUrlSanitizer->sanitize($action);
                 try {
                     // Check if the action is valid
                     $reflectionClass = new ReflectionClass($controller);
                     $actionMethod = $reflectionClass->getMethod($action);
                     if ($action !== 'index' && (method_exists('Controller', $action) || !$actionMethod->isPublic() || $actionMethod->class !== get_class($controller))) {
                         throw new DispatcherException();
                     }
                 } catch (Exception $e) {
                     throw new ErrorCode(ErrorCode::NOT_FOUND, 'Tried to access invalid action.');
                 }
                 $controller->setAction($action);
                 $parameters = array();
                 $stringParameters = array();
                 $i = 0;
                 foreach ($actionMethod->getParameters() as $parameter) {
                     $actionParameter = isset($actionParameters[$i]) ? $actionParameters[$i] : null;
                     if ($actionParameter === null) {
                         if (!$parameter->isDefaultValueAvailable()) {
                             throw new ErrorCode(ErrorCode::BAD_REQUEST, 'Not all parameters supplied.');
                         }
                         // Well: there is no more additional query, and apparently the rest of the parameters are optional, so continue.
                         continue;
                     }
                     if (($parameterTypeClass = $parameter->getClass()) != false) {
                         if (!$parameterTypeClass->isSubclassOf('RW_Type')) {
                             throw new ErrorCode(ErrorCode::BAD_REQUEST, 'Invalid parameter type.');
                         }
                         $parameterTypeClassName = $parameterTypeClass->getName();
                         $parameters[] = new $parameterTypeClassName($actionParameter);
                     } else {
                         $parameters[] = $actionParameter;
                     }
                     $stringParameters[] = $actionParameter;
                     $i++;
                 }
                 $controller->setActionParameters($stringParameters);
                 if (!$skipControllerInitialization) {
                     $controller->initialize();
                 }
                 // This actually calls the apropriate action.
                 call_user_func_array(array($controller, $action), $parameters);
                 $controller->extendModel();
                 try {
                     $this->renderers->render($controller->getViewName(), $model, $this->notificationCenter, $this->theme->getTemplatesPath(), $contentTypes, $controller);
                 } catch (Exception $e) {
                     throw new ErrorCode(ErrorCode::INTERNAL_SERVER_ERROR, 'Error during render: ' . $e->getMessage());
                 }
             } catch (ErrorMessageException $e) {
                 $errorDuringRender = true;
                 $this->notificationCenter->addError($e->getMessage());
             } catch (ErrorCode $e) {
                 throw $e;
             } catch (Exception $e) {
                 $additionalInfo = array();
                 $additionalInfo['controllerName'] = $controllerName;
                 if (isset($action)) {
                     $additionalInfo['action'] = $action;
                 }
                 $additionalInfo['exceptionThrown'] = get_class($e);
                 $additionalInfo['error'] = $e->getMessage();
                 Log::warning($e->getMessage(), 'Dispatcher', $additionalInfo);
                 throw new ErrorCode(ErrorCode::INTERNAL_SERVER_ERROR);
             }
         } catch (ErrorCode $e) {
             // All other exceptions have already been caught.
             $errorDuringRender = true;
             $errorCode = $e->getCode();
             $e->writeHttpHeader();
             if ($e->getMessage()) {
                 Log::debug($e->getMessage(), 'Dispatcher');
             }
         }
         if ($errorDuringRender) {
             $this->renderers->renderError($errorCode, $model, $this->notificationCenter, $this->theme->getTemplatesPath(), $contentTypes);
         }
     } catch (Exception $e) {
         try {
             Log::fatal('There has been a fatal error dispatching.', 'Dispatcher', array('error' => $e->getMessage()));
             $this->renderers->renderFatalError($this->notificationCenter, $this->theme->getTemplatesPath(), $contentTypes);
         } catch (Exception $e) {
             die('<h1 class="error">Fatal error...</h1>');
         }
     }
     Profile::stop();
 }
开发者ID:enyo,项目名称:rincewind,代码行数:101,代码来源:DefaultDispatcher.php

示例10: render

 /**
  * {@inheritdoc}
  */
 public function render($viewName, Model $model, NotificationCenter $notificationCenter, $output = true)
 {
     Profile::start('Renderer', 'Generate HTML');
     $templateName = $viewName . '.' . static::$templateFileExtension;
     $dwoo = new Dwoo($this->compiledPath, $this->cachePath);
     $dwoo->getLoader()->addDirectory($this->functionsPath);
     Profile::start('Renderer', 'Create template file.');
     $template = new Dwoo_Template_File($templateName);
     $template->setIncludePath($this->getTemplatesPath());
     Profile::stop();
     Profile::start('Renderer', 'Render');
     $dwooData = new Dwoo_Data();
     $dwooData->setData($model->getData());
     $dwooData->assign('errorMessages', $notificationCenter->getErrors());
     $dwooData->assign('successMessages', $notificationCenter->getSuccesses());
     $this->setHeader('Content-type: text/html', $output);
     // I do never output directly from dwoo to have the possibility to show an error page if there was a render error.
     $result = $rendered = $dwoo->get($template, $dwooData, null, false);
     if ($output) {
         echo $result;
     }
     Profile::stop();
     Profile::stop();
     return $output ? null : $rendered;
 }
开发者ID:enyo,项目名称:rincewind,代码行数:28,代码来源:DwooRenderer.php


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