/**
  * Tests the parsing of segment conditions from their string
  * representations.
  */
 public function testParsingFromString()
 {
     $condition = new GaDataSegmentSimpleCondition('ga:foo<>foo\\,bar_bar\\;baz');
     $this->assertEquals('ga:foo', $condition->getLeftOperand());
     $this->assertEquals(GaDataSegmentSimpleCondition::OP_BETWEEN, $condition->getOperator());
     $this->assertEquals('foo\\,bar_bar\\;baz', $condition->getRightOperand());
     $condition = new GaDataSegmentSimpleCondition('ga:foo[]bar|baz|bam');
     $this->assertEquals('ga:foo', $condition->getLeftOperand());
     $this->assertEquals(GaDataSegmentSimpleCondition::OP_IN, $condition->getOperator());
     $this->assertEquals('bar|baz|bam', $condition->getRightOperand());
 }
 /**
  * Parses a sequence condition into its component pieces.
  *
  * @param string $str
  */
 protected function _setPropertiesFromString($str)
 {
     /* This isn't quite as slick as the approach that
     		Google\Analytics\GaDataConditionalExpression uses to find the operator,
     		but it does ensure that we only match the correct operators, and it's
     		unlikely this will need much (if any) maintenance in the future. */
     $operators = array(self::OP_FOLLOWED_BY, self::OP_FOLLOWED_BY_IMMEDIATE, self::OP_FIRST_HIT_MATCHES_FIRST_STEP);
     foreach ($operators as $operator) {
         $len = strlen($operator);
         if (substr($str, 0, $len) == $operator) {
             $this->_constraintAgainstPrevious = $operator;
             $str = substr($str, $len);
             break;
         }
     }
     // See if there were any additional conditions
     $conditions = \PFXUtils::explodeUnescaped(GaDataLogicalCollection::OP_AND, $str);
     $str = array_shift($conditions);
     foreach ($conditions as $condition) {
         $this->addCondition(new GaDataSegmentSimpleCondition($condition));
     }
     parent::_setPropertiesFromString($str);
 }