Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\CssSelector\Parser\Handler; Chris@0: Chris@0: use Symfony\Component\CssSelector\Parser\Reader; Chris@0: use Symfony\Component\CssSelector\Parser\TokenStream; Chris@0: Chris@0: /** Chris@0: * CSS selector comment handler. Chris@0: * Chris@0: * This component is a port of the Python cssselect library, Chris@0: * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. Chris@0: * Chris@0: * @author Jean-François Simon Chris@0: * Chris@0: * @internal Chris@0: */ Chris@0: class CommentHandler implements HandlerInterface Chris@0: { Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function handle(Reader $reader, TokenStream $stream) Chris@0: { Chris@0: if ('/*' !== $reader->getSubstring(2)) { Chris@0: return false; Chris@0: } Chris@0: Chris@0: $offset = $reader->getOffset('*/'); Chris@0: Chris@0: if (false === $offset) { Chris@0: $reader->moveToEnd(); Chris@0: } else { Chris@0: $reader->moveForward($offset + 2); Chris@0: } Chris@0: Chris@0: return true; Chris@0: } Chris@0: }