1<?php 2/** 3 * Matomo - free/libre analytics platform 4 * 5 * @link https://matomo.org 6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later 7 */ 8 9namespace Piwik\Plugins\TagManager\Input; 10 11use Piwik\Piwik; 12use Piwik\Validators\BaseValidator; 13use Piwik\Validators\CharacterLength; 14use Piwik\Validators\NotEmpty; 15 16class Name 17{ 18 const MAX_LENGTH = 50; 19 20 /** 21 * @var string 22 */ 23 private $name; 24 25 public function __construct($name) 26 { 27 $this->name = $name; 28 } 29 30 public function check() 31 { 32 $title = Piwik::translate('General_Name'); 33 34 BaseValidator::check($title, $this->name, [new NotEmpty(), new CharacterLength(1, self::MAX_LENGTH)]); 35 } 36 37} 38