当前位置: 首页>>代码示例>>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;未经允许,请勿转载。