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


PHP Process::getName方法代码示例

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


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

示例1: createReport4Process

 /**
  * Generates the report for one single process.
  *
  * @param Process $process the current process.
  *
  * @return string The report for the current process.
  *
  * @author Christian Schäfer
  * @version
  * Version 0.1, 01.01.2007<br />
  * Version 0.2, 29.12.2009 (Refactored markup)<br />
  */
 private function createReport4Process(Process $process)
 {
     $level = $process->getLevel();
     // add closing dl only if level greater than 0 to have
     // correct definition list leveling!
     $buffer = '<dl style="margin-left: ' . $level * 20 . 'px;">';
     // assemble class for the current line
     if ($this->lineCounter % 2 == 0) {
         $class = 'even';
     } else {
         $class = 'odd';
     }
     // increment the line counter to be able to distinguish between even and odd lines
     $this->lineCounter++;
     $buffer .= PHP_EOL;
     $buffer .= '    <dt class="' . $class . '">' . $process->getName() . '</dt>';
     $buffer .= PHP_EOL;
     // add specific run time class to mark run times greater that the critical time
     $time = $process->getDuration();
     $buffer .= '    <dd class="' . $class . ' ' . $this->getMarkedUpProcessTimeClass($time) . '">' . $time . ' s';
     $buffer .= '</dd>';
     $buffer .= PHP_EOL;
     // add closing dl only if level greater than 0 to have
     // correct definition list leveling!
     $buffer .= '</dl>';
     return $buffer;
 }
开发者ID:GeneralCrime,项目名称:code,代码行数:39,代码来源:HtmlReport.php

示例2: testName

 public function testName()
 {
     $this->state->expects($this->any())->method('__toString')->willReturn('stateName');
     $process = new Process('processName', '\\stdClass', 'stateName', [$this->state]);
     $this->assertEquals('processName', $process->getName());
 }
开发者ID:potfur,项目名称:statemachine,代码行数:6,代码来源:ProcessTest.php

示例3: execute

 /**
  * Execute a new process, and add it to the process table.
  * This function do not return any value, it fills the object Process received in the arguments
  * with the information of the new process.
  * 
  * @param Process $proc The process to be executed, the attribute <b>name</b> should be filled with the application name to execute
  * @throws EyeInvalidArgumentException If the arguments are incorrect
  */
 public function execute(Process $proc)
 {
     try {
         $processTable = $this->getProcessesTable();
         do {
             $pid = mt_rand(ProcManager::MINPIDNUMBER, ProcManager::MAXPIDNUMBER);
         } while (array_key_exists($pid, $processTable));
         $proc->setPid($pid);
         $proc->setTime(time());
         $proc->setChecknum(mt_rand(ProcManager::MINCHECKNUMNUMBER, ProcManager::MAXCHECKNUMNUMBER));
         //Check if we are in a context
         //if given process has no login context, default is to copy the current process' one
         if ($proc->getLoginContext() === null) {
             if ($this->currentProcess !== null) {
                 $currentLoginContext = $this->currentProcess->getLoginContext();
                 if ($currentLoginContext !== null) {
                     $proc->setLoginContext(clone $currentLoginContext);
                 } else {
                     //FIXME: TODO: move to a metadata!!!!
                     if ($proc->getName() != 'login' && $proc->getName() != 'init' && $proc->getName() != 'register') {
                         throw new EyeProcException('Cannot execute this application without a valid login context');
                     }
                 }
             }
         }
         Kernel::enterSystemMode();
         //when executing the first process, we need to tell the system
         //that our session has been activated. So regenerated is 0
         if (count($processTable) == 0) {
             $this->memoryManager->set('regenerated', 0);
         }
         $processTable[$pid] = $proc;
         $this->currentProcess = $proc;
         $this->memoryManager->set('processTable', $processTable);
         Kernel::exitSystemMode();
         $this->logger->debug('Process execution started: ' . $proc);
         $this->fireEvent('processStarted', new ProcEvent($proc));
     } catch (Exception $e) {
         $this->logger->warn('Error executing process: ' . $proc . ' (' . $e->getMessage() . ')');
         if ($this->logger->isDebugEnabled()) {
             $this->logger->debug(ExceptionStackUtil::getStackTrace($e, false));
         }
         throw $e;
     }
 }
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:53,代码来源:ProcManager.php


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