コード例 #1
0
 /**
  * @param string $name
  */
 public function setName($name)
 {
     if (NameUtils::isValidVariableName($name)) {
         $this->name = $name;
     } else {
         throw new \InvalidArgumentException(sprintf('Specified property name "%s" is not valid.', $name));
     }
 }
コード例 #2
0
 /**
  * Constructor
  *
  * @param string $name
  * @param string $phpType
  * @param null|string $defaultValue
  */
 public function __construct($name, $phpType = 'mixed', $defaultValue = null)
 {
     if (NameUtils::isValidVariableName($name)) {
         $this->name = $name;
     } else {
         throw new \InvalidArgumentException(sprintf('Specified parameter name "%s" is not valid.', $name));
     }
     $this->phpType = $phpType;
     $this->defaultValue = $defaultValue;
 }