/**
  * @covers \DCarbone\PHPClassBuilder\Utilities\NameUtils::isValidClassName
  */
 public function testReturnFalseWithInvalidClassNames()
 {
     $this->assertFalse(NameUtils::isValidClassName('91notvalid'));
     $this->assertFalse(NameUtils::isValidClassName('nope nope'));
     $this->assertFalse(NameUtils::isValidClassName(''));
     $this->assertFalse(NameUtils::isValidClassName(true));
     $this->assertFalse(NameUtils::isValidClassName(null));
     $this->assertFalse(NameUtils::isValidClassName(12345));
 }
 /**
  * @param array $opts
  * @return string
  */
 public function compile(array $opts = array())
 {
     if (false === NameUtils::isValidVariableName($this->getName())) {
         throw $this->createMissingNameException('Variable name not defined at compile time');
     }
     list($type, $includeComment, $leadingSpaces, $includeDefaultValue) = $this->parseCompileOpts($opts);
     switch ($type) {
         case self::COMPILETYPE_VARIABLE:
             return $this->_compileAsVariable($includeComment, $leadingSpaces, $includeDefaultValue);
         case self::COMPILETYPE_PROPERTY:
             return $this->_compileAsClassProperty($includeComment, $leadingSpaces, $includeDefaultValue);
         case self::COMPILETYPE_PARAMETER:
             return $this->_compileAsMethodParameter($includeDefaultValue);
             // TODO: Should not be reachable, but do something?
         // TODO: Should not be reachable, but do something?
         default:
             return '';
     }
 }
 /**
  * @param array $opts
  * @return string
  * @throws \DCarbone\PHPClassBuilder\Exception\MissingNameException
  */
 public function compile(array $opts = array())
 {
     if (false === NameUtils::isValidFunctionName($this->getName())) {
         throw $this->createMissingNameException('Function name not defined at compile time');
     }
     list($type, $leadingSpaces, $includeComment, $incBody) = $this->parseCompileOpts($opts);
     switch ($type) {
         case self::COMPILETYPE_FUNCTION:
             return $this->_compileAsFunction($leadingSpaces, $includeComment, $incBody);
         case self::COMPILETYPE_CLASSMETHOD:
             return $this->_compileAsClassMethod($leadingSpaces, $includeComment, $incBody);
             // TODO: Should not be reachable, but do something?
         // TODO: Should not be reachable, but do something?
         default:
             return '';
     }
 }
 /**
  * @param null|string $namespace
  */
 public function setNamespace($namespace)
 {
     if (NameUtils::isValidNamespaceName($namespace)) {
         $this->_namespace = $namespace;
     } else {
         throw $this->createInvalidNamespaceNameException($namespace);
     }
 }