本文整理汇总了PHP中Symfony\Component\Finder\Shell\Command::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::add方法的具体用法?PHP Command::add怎么用?PHP Command::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Finder\Shell\Command
的用法示例。
在下文中一共展示了Command::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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('{}');
}
}
示例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('{}');
}
}
示例3: 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);
}
}
}