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


PHP Shell\Command類代碼示例

本文整理匯總了PHP中Symfony\Component\Finder\Shell\Command的典型用法代碼示例。如果您正苦於以下問題:PHP Command類的具體用法?PHP Command怎麽用?PHP Command使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: buildContentFiltering

 protected function buildContentFiltering(Command $command, array $contains, $not = false)
 {
     foreach ($contains as $contain) {
         $expr = Expression::create($contain);
         $command->add('| xargs -I{} -r grep -I')->add($expr->isCaseSensitive() ? null : '-i')->add($not ? '-L' : '-l')->add('-Ee')->arg($expr->renderPattern())->add('{}');
     }
 }
開發者ID:itillawarra,項目名稱:cmfive,代碼行數:7,代碼來源:GnuFindAdapter.php

示例2: buildContentFiltering

 /**
  * {@inheritdoc}
  */
 protected function buildContentFiltering(Command $command, array $contains, $not = false)
 {
     foreach ($contains as $contain) {
         $expr = Expression::create($contain);
         // todo: avoid forking process for each $pattern by using multiple -e options
         $command->add('| grep -v \'^$\'')->add('| xargs -I{} grep -I')->add($expr->isCaseSensitive() ? null : '-i')->add($not ? '-L' : '-l')->add('-Ee')->arg($expr->renderPattern())->add('{}');
     }
 }
開發者ID:TheTypoMaster,項目名稱:SPHERE-Framework,代碼行數:11,代碼來源:BsdFindAdapter.php

示例3: testCastToString

 public function testCastToString()
 {
     $cmd = Command::create();
     $cmd->add('--force');
     $cmd->add('--run');
     $this->assertSame('--force --run', (string) $cmd);
 }
開發者ID:Kyra2778,項目名稱:AMR,代碼行數:7,代碼來源:CommandTest.php

示例4: buildDatesFiltering

 private function buildDatesFiltering(Command $command, array $dates)
 {
     foreach ($dates as $i => $date) {
         $command->add($i > 0 ? '-and' : null);
         $mins = (int) round((time() - $date->getTarget()) / 60);
         if (0 > $mins) {
             $command->add(' -mmin -0');
             return;
         }
         switch ($date->getOperator()) {
             case '<=':
                 $command->add('-mmin +' . ($mins - 1));
                 break;
             case '>=':
                 $command->add('-mmin -' . ($mins + 1));
                 break;
             case '>':
                 $command->add('-mmin -' . $mins);
                 break;
             case '!=':
                 $command->add('-mmin +' . $mins . ' -or -mmin -' . $mins);
                 break;
             case '<':
             default:
                 $command->add('-mmin +' . $mins);
         }
     }
 }
開發者ID:VicDeo,項目名稱:poc,代碼行數:28,代碼來源:AbstractFindAdapter.php

示例5: __construct

 /**
  * @param AdapterInterface $adapter
  * @param Command          $command
  * @param \Exception|null  $previous
  */
 public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
 {
     $this->command = $command;
     parent::__construct($adapter, 'Shell command failed: "' . $command->join() . '".', $previous);
 }
開發者ID:EnmanuelCode,項目名稱:backend-laravel,代碼行數:10,代碼來源:ShellCommandFailureException.php

示例6: buildFormatSorting

 /**
  * {@inheritdoc}
  */
 protected function buildFormatSorting(Command $command, $format)
 {
     $command->get('find')->add('-printf')->arg($format . ' %h/%f\\n')->add('| sort | cut')->arg('-d ')->arg('-f2-');
 }
開發者ID:netvlies,項目名稱:symfony,代碼行數:7,代碼來源:GnuFindAdapter.php

示例7: buildSorting

    private function buildSorting(Command $command, $sort)
    {
        switch ($sort) {
            case SortableIterator::SORT_BY_NAME:
                $format = null;
                break;
            case SortableIterator::SORT_BY_TYPE:
                $format = '%y';
                break;
            case SortableIterator::SORT_BY_ACCESSED_TIME:
                $format = '%A@';
                break;
            case SortableIterator::SORT_BY_CHANGED_TIME:
                $format = '%C@';
                break;
            case SortableIterator::SORT_BY_MODIFIED_TIME:
                $format = '%T@';
                break;
            default:
                throw new \InvalidArgumentException('Unknown sort options: '.$sort.'.');
        }

        $command->get('find')->add('-printf')->arg($format.' %h/%f\\n');
        $command->ins('sort')->add('| sort');
        $command->ins('awk')->add('| awk')->arg('{ print $'.(null === $format ? '1' : '2').' }');
    }
開發者ID:n3b,項目名稱:symfony,代碼行數:26,代碼來源:GnuFindAdapter.php

示例8: buildSorting

 /**
  * @param Command $command
  * @param string  $sort
  *
  * @throws \InvalidArgumentException
  */
 private function buildSorting(Command $command, $sort)
 {
     switch ($sort) {
         case SortableIterator::SORT_BY_NAME:
             $command->ins('sort')->add('| sort');
             return;
         case SortableIterator::SORT_BY_TYPE:
             $format = '%y';
             break;
         case SortableIterator::SORT_BY_ACCESSED_TIME:
             $format = '%A@';
             break;
         case SortableIterator::SORT_BY_CHANGED_TIME:
             $format = '%C@';
             break;
         case SortableIterator::SORT_BY_MODIFIED_TIME:
             $format = '%T@';
             break;
         default:
             throw new \InvalidArgumentException('Unknown sort options: ' . $sort . '.');
     }
     $this->buildFormatSorting($command, $format);
 }
開發者ID:nicam,項目名稱:symfony,代碼行數:29,代碼來源:AbstractFindAdapter.php


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