This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Components/CssSelector/XPathExprOr.php

47 lines
1.1 KiB
PHP
Raw Normal View History

2010-03-31 07:42:18 +01:00
<?php
namespace Symfony\Components\CssSelector;
/*
* This file is part of the symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* XPathExprOr represents XPath |'d expressions.
*
* Note that unfortunately it isn't the union, it's the sum, so duplicate elements will appear.
*
* This component is a port of the Python lxml library,
* which is copyright Infrae and distributed under the BSD license.
*
* @package symfony
* @subpackage css_selector
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class XPathExprOr extends XPathExpr
{
public function __construct($items, $prefix = null)
{
$this->items = $items;
$this->prefix = $prefix;
}
public function __toString()
{
$prefix = $this->prefix;
$tmp = array();
foreach ($this->items as $i)
{
$tmp[] = sprintf("%s%s", $prefix, $i);
}
return implode($tmp, ' | ');
}
}