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


PHP Command::ins方法代碼示例

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


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

示例1: buildFormatSorting

    /**
     * {@inheritdoc}
     */
    protected function buildFormatSorting(Command $command, $sort)
    {
        switch ($sort) {
            case SortableIterator::SORT_BY_NAME:
                $command->ins('sort')->add('| sort');

                return;
            case SortableIterator::SORT_BY_TYPE:
                $format = '%HT';
                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 = '%m';
                break;
            default:
                throw new \InvalidArgumentException('Unknown sort options: '.$sort.'.');
        }

        $command
            ->add('-print0 | xargs -0 stat -f')
            ->arg($format.'%t%N')
            ->add('| sort | cut -f 2');
    }
開發者ID:Robert-Xie,項目名稱:php-framework-benchmark,代碼行數:31,代碼來源:BsdFindAdapter.php

示例2: buildFormatSorting

    /**
     * {@inheritdoc}
     */
    protected function buildFormatSorting(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.'.');
        }

        $command
            ->get('find')
            ->add('-printf')
            ->arg($format.' %h/%f\\n')
            ->add('| sort | cut')
            ->arg('-d ')
            ->arg('-f2-')
        ;
    }
開發者ID:Robert-Xie,項目名稱:php-framework-benchmark,代碼行數:35,代碼來源:GnuFindAdapter.php

示例3: buildFindCommand

 protected function buildFindCommand(Command $command, $dir)
 {
     return $command->ins('find')->add('find ')->arg($dir)->add('-noleaf');
 }
開發者ID:VicDeo,項目名稱:poc,代碼行數:4,代碼來源:AbstractFindAdapter.php

示例4: buildFindCommand

 /**
  * @param Command $command
  * @param string  $dir
  *
  * @return Command
  */
 protected function buildFindCommand(Command $command, $dir)
 {
     return $command->ins('find')->add('find ')->arg($dir)->add('-noleaf');
     // the -noleaf option is required for filesystems that don't follow the '.' and '..' conventions
 }
開發者ID:betes-curieuses-design,項目名稱:ElieJosiePhotographie,代碼行數:11,代碼來源:AbstractFindAdapter.php

示例5: 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

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