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


PHP Input::workflow方法代碼示例

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


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

示例1: show

 /**
  * Show operation details for a workflow
  *
  * ## OPTIONS
  * [--workflow_id]
  * : Uuid of workflow to show
  * [--site=<site>]
  * : Site from which to list workflows
  * [--latest-with-logs]
  * : Display the most-recent workflow with logs
  *
  * @subcommand show
  */
 public function show($args, $assoc_args)
 {
     $site = $this->sites->get(Input::siteName(array('args' => $assoc_args)));
     if (isset($assoc_args['workflow_id'])) {
         $workflow_id = $assoc_args['workflow_id'];
         $model_data = (object) array('id' => $workflow_id);
         $workflow = $site->workflows->add($model_data);
     } elseif (isset($assoc_args['latest-with-logs'])) {
         $site->workflows->fetch(array('paged' => false));
         $workflow = $site->workflows->findLatestWithLogs();
         if (!$workflow) {
             $this->log()->info('No recent workflow has logs');
             return;
         }
     } else {
         $site->workflows->fetch(array('paged' => false));
         $workflows = $site->workflows->all();
         $workflow = Input::workflow(compact('workflows'));
     }
     $workflow->fetchWithLogs();
     $workflow_data = $workflow->serialize();
     if (Terminus::getConfig('format') == 'normal') {
         unset($workflow_data['operations']);
         $this->output()->outputRecord($workflow_data);
         $operations = $workflow->operations();
         if (count($operations)) {
             // First output a table of operations without logs
             $operations_data = array_map(function ($operation) {
                 $operation_data = $operation->serialize();
                 unset($operation_data['id']);
                 unset($operation_data['log_output']);
                 return $operation_data;
             }, $operations);
             $this->output()->outputRecordList($operations_data, array('description' => 'Operation Description'));
             // Second output the logs
             foreach ($operations as $operation) {
                 if ($operation->has('log_output')) {
                     $log_msg = sprintf("\n------ %s ------\n%s", $operation->description(), $operation->get('log_output'));
                     $this->output()->outputValue($log_msg);
                 }
             }
         } else {
             $this->output()->outputValue('Workflow has no operations');
         }
     } else {
         $this->output()->outputRecord($workflow_data);
     }
 }
開發者ID:dalin-,項目名稱:cli,代碼行數:61,代碼來源:WorkflowsCommand.php

示例2: show

 /**
  * Show operation details for a workflow
  *
  * ## OPTIONS
  * [--workflow_id]
  * : Uuid of workflow to show
  * [--site=<site>]
  * : Site from which to list workflows
  *
  * @subcommand show
  */
 public function show($args, $assoc_args)
 {
     $site = $this->sites->get(Input::sitename($assoc_args));
     $workflow = Input::workflow($site, $assoc_args, 'workflow_id');
     $workflow_data = $workflow->serialize();
     if (Terminus::getConfig('format') == 'normal') {
         $operations_data = $workflow_data['operations'];
         unset($workflow_data['operations']);
         $this->output()->outputRecord($workflow_data);
         if (count($operations_data)) {
             $this->log()->info('Workflow operations:');
             $this->output()->outputRecordList($operations_data);
         } else {
             $this->log()->info('Workflow has no operations');
         }
     } else {
         $this->output()->outputRecordList($workflow_data);
     }
 }
開發者ID:bjargud,項目名稱:cli,代碼行數:30,代碼來源:WorkflowsCommand.php

示例3: logs

 /**
  * Show quicksilver logs from a workflow
  *
  * ## OPTIONS
  * [--latest]
  * : Display the most-recent workflow with logs
  * [--workflow_id]
  * : Uuid of workflow to fetch logs for
  * [--site=<site>]
  * : Site from which to list workflows
  *
  * @subcommand logs
  */
 public function logs($args, $assoc_args)
 {
     $site = $this->sites->get(Input::sitename($assoc_args));
     if (isset($assoc_args['latest'])) {
         $site->workflows->fetchWithOperationsAndLogs(array('paged' => false));
         $workflow = $site->workflows->findLatestWithLogs();
         if (is_null($workflow)) {
             return $this->failure('No recent workflows contain logs');
         }
     } else {
         $site->workflows->fetchWithOperations(array('paged' => false));
         $workflows = $site->workflows->all();
         $workflow = Input::workflow($workflows, $assoc_args, 'workflow_id');
         $workflow->fetchWithLogs();
     }
     if (Terminus::getConfig('format') == 'normal') {
         $operations = $workflow->operations();
         if (count($operations) == 0) {
             $this->log()->info('Workflow has no operations');
             return;
         }
         $operations_with_logs = array_filter($operations, function ($operation) {
             return $operation->get('log_output');
         });
         if (count($operations_with_logs) == 0) {
             $this->log()->info('Workflow has no operations with logs');
             return;
         }
         foreach ($operations as $operation) {
             if ($operation->get('log_output')) {
                 $operation_data = $operation->serialize();
                 $this->output()->outputRecord($operation_data);
             }
         }
     } else {
         $workflow_data = $workflow->serialize();
         $operations_data = $workflow_data['operations'];
         $this->output()->outputRecordList($operations_data);
     }
 }
開發者ID:Zacker,項目名稱:cli,代碼行數:53,代碼來源:WorkflowsCommand.php


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