Piwik\Settings\Settings::__construct PHP Méthode

__construct() public méthode

public __construct ( )
    public function __construct()
    {
        if (!isset($this->pluginName)) {
            $classname = get_class($this);
            $parts = explode('\\', $classname);
            if (count($parts) >= 3) {
                $this->pluginName = $parts[2];
            } else {
                throw new \Exception(sprintf('Plugin Settings must have a plugin name specified in %s, could not detect plugin name', $classname));
            }
        }
    }

Usage Example

Exemple #1
0
 /**
  * Constructor.
  * @param int $idSite If creating settings for a new site that is not created yet, use idSite = 0
  * @param string|null $idMeasurableType If null, idType will be detected from idSite
  * @throws Exception
  */
 public function __construct($idSite, $idMeasurableType = null)
 {
     parent::__construct();
     $this->idSite = (int) $idSite;
     if (!empty($idMeasurableType)) {
         $this->idMeasurableType = $idMeasurableType;
     } elseif (!empty($idSite)) {
         $this->idMeasurableType = Site::getTypeFor($idSite);
     } else {
         throw new Exception('No idType specified for ' . get_class($this));
     }
     $this->init();
 }
All Usage Examples Of Piwik\Settings\Settings::__construct