예제 #1
0
 public function execute()
 {
     $logger = $this->getLogger();
     $config = $this->getConfigLoader();
     $this->logger->debug('Finding schemas...');
     $actionLogger = new ActionLogger(STDERR);
     $schemas = SchemaUtils::findSchemasByArguments($this->getConfigLoader(), func_get_args(), $this->logger);
     foreach ($schemas as $schema) {
         if ($this->logger->isVerbose()) {
             $actionLog = $actionLogger->newAction(get_class($schema), get_class($schema));
             $actionLog->setActionColumnWidth(50);
         } elseif ($this->logger->isDebug()) {
             $filepath = str_replace(getcwd() . '/', '', $schema->getClassFileName());
             $actionLog = $actionLogger->newAction($filepath, get_class($schema));
             $actionLog->setActionColumnWidth(50);
         } else {
             $actionLog = $actionLogger->newAction($schema->getShortClassName(), get_class($schema));
         }
         $actionLog->setStatus('checking');
         if ($schema->requireProxyFileUpdate()) {
             $actionLog->setStatus('modified', 'yellow');
         } else {
             $actionLog->setStatus('up-to-date');
         }
         $actionLog->finalize();
     }
 }
예제 #2
0
<?php

require 'vendor/autoload.php';
use CLIFramework\Logger\ActionLogger;
use CLIFramework\Formatter;
$logger = new ActionLogger(fopen('php://stderr', 'w'), new Formatter());
foreach (['ProductSchema', 'OrderSchema', 'OrderItemSchema'] as $title) {
    $logAction = $logger->newAction($title, 'Update schema class files...');
    foreach (['checking', 'updating', 'pulling'] as $status) {
        $logAction->setStatus($status);
        sleep(1);
    }
    $logAction->done();
}