Example #1
0
 /**
  * Constructor
  *
  * @param string $fhirElementName
  * @param string $className
  * @param string $namespace
  * @param ComplexClassTypesEnum $classType
  */
 public function __construct($fhirElementName, $className, $namespace, ComplexClassTypesEnum $classType = null)
 {
     if (NameUtils::isValidClassName($className)) {
         $this->_className = $className;
     } else {
         throw new \InvalidArgumentException('Class Name "' . $className . '" is not valid.');
     }
     if (NameUtils::isValidNSName($namespace)) {
         $this->_namespace = $namespace;
     } else {
         throw new \InvalidArgumentException('Namespace "' . $namespace . '" is not valid.');
     }
     $this->_elementName = $fhirElementName;
     $this->_classType = $classType;
 }
Example #2
0
 /**
  * @param string $xsdPath
  * @param string $outputPath
  * @param string $outputNamespace
  * @return array
  */
 private static function _validateInput($xsdPath, $outputPath, $outputNamespace)
 {
     // Bunch'o validation
     if (false === is_dir($xsdPath)) {
         throw new \RuntimeException('Unable to locate XSD dir "' . $xsdPath . '"');
     }
     if (false === is_readable($xsdPath)) {
         throw new \RuntimeException('This process does not have read access to directory "' . $xsdPath . '"');
     }
     if (null === $outputPath) {
         $outputPath = PHPFHIR_DEFAULT_OUTPUT_DIR;
     }
     if (!is_dir($outputPath)) {
         throw new \RuntimeException('Unable to locate output dir "' . $outputPath . '"');
     }
     if (!is_writable($outputPath)) {
         throw new \RuntimeException(sprintf('Specified output path "%s" is not writable by this process.', $outputPath));
     }
     if (!is_readable($outputPath)) {
         throw new \RuntimeException(sprintf('Specified output path "%s" is not readable by this process.', $outputPath));
     }
     if (null === $outputNamespace) {
         $outputNamespace = PHPFHIR_DEFAULT_NAMESPACE;
     }
     if (false === NameUtils::isValidNSName($outputNamespace)) {
         throw new \InvalidArgumentException(sprintf('Specified root namespace "%s" is not a valid PHP namespace.', $outputNamespace));
     }
     return array($xsdPath, $outputPath, $outputNamespace);
 }