Piwik\Segment::__construct PHP Method

__construct() public method

Constructor.
public __construct ( string $segmentCondition, array $idSites )
$segmentCondition string The segment condition, eg, `'browserCode=ff;countryCode=CA'`.
$idSites array The list of sites the segment will be used with. Some segments are dependent on the site, such as goal segments.
    public function __construct($segmentCondition, $idSites)
    {
        $this->segmentQueryBuilder = StaticContainer::get('Piwik\\DataAccess\\LogQueryBuilder');
        $segmentCondition = trim($segmentCondition);
        if (!SettingsPiwik::isSegmentationEnabled() && !empty($segmentCondition)) {
            throw new Exception("The Super User has disabled the Segmentation feature.");
        }
        // First try with url decoded value. If that fails, try with raw value.
        // If that also fails, it will throw the exception
        try {
            $this->initializeSegment(urldecode($segmentCondition), $idSites);
        } catch (Exception $e) {
            $this->initializeSegment($segmentCondition, $idSites);
        }
    }