Piwik\Columns\Dimension::getId PHP Метод

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

Returns a unique string ID for this dimension. The ID is built using the namespaced class name of the dimension, but is modified to be more human readable.
public getId ( ) : string
Результат string eg, `"Referrers.Keywords"`
    public function getId()
    {
        $className = get_class($this);
        // parse plugin name & dimension name
        $regex = "/Piwik\\\\Plugins\\\\([^\\\\]+)\\\\" . self::COMPONENT_SUBNAMESPACE . "\\\\([^\\\\]+)/";
        if (!preg_match($regex, $className, $matches)) {
            throw new Exception("'{$className}' is located in the wrong directory.");
        }
        $pluginName = $matches[1];
        $dimensionName = $matches[2];
        return $pluginName . '.' . $dimensionName;
    }

Usage Example

Пример #1
0
 /**
  * @param Dimension|null $lhs
  * @param Dimension|null $rhs
  * @return bool
  */
 private static function areDimensionsNotEqualAndNotNull($lhs, $rhs)
 {
     return !empty($lhs) && !empty($rhs) && $lhs->getId() != $rhs->getId();
 }
All Usage Examples Of Piwik\Columns\Dimension::getId