Piwik\Settings\Measurable\MeasurableProperty::__construct PHP Метод

__construct() публичный Метод

Constructor.
public __construct ( string $name, mixed $defaultValue, string $type, string $pluginName, integer $idSite )
$name string The persisted name of the setting.
$defaultValue mixed Default value for this setting if no value was specified.
$type string Eg an array, int, ... see TYPE_* constants
$pluginName string The name of the plugin the setting belongs to.
$idSite integer The idSite this property belongs to.
    public function __construct($name, $defaultValue, $type, $pluginName, $idSite)
    {
        if (!in_array($name, $this->allowedNames)) {
            throw new Exception(sprintf('Name "%s" is not allowed to be used with a MeasurableProperty, use a MeasurableSetting instead.', $name));
        }
        parent::__construct($name, $defaultValue, $type, $pluginName);
        $this->idSite = $idSite;
        $storageFactory = StaticContainer::get('Piwik\\Settings\\Storage\\Factory');
        $this->storage = $storageFactory->getSitesTable($idSite);
    }

Usage Example

Пример #1
0
 public function __construct($idSite)
 {
     $name = 'urls';
     $pluginName = 'WebsiteMeasurable';
     $defaultValue = array('http://siteUrl.com/', 'http://siteUrl2.com/');
     $type = FieldConfig::TYPE_ARRAY;
     parent::__construct($name, $defaultValue, $type, $pluginName, $idSite);
 }