src/XSD2PHP/src/com/mikebevz/xsd2php/PHPClass.php
public function getPhpCode()
    {
        $code = "\n";
        if ($this->extendsNamespace != '') {
            if (false === $this->overrideAsSingleNamespace) {
                $code .= "use ".$this->extendsNamespace.";\n";
            }
        }

        if (!empty($this->classDocBlock)) {
            $code .= $this->getDocBlock($this->classDocBlock);
        }

        if ($this->name == $this->classPrefix.$this->extends) {
            $this->name = $this->name . "Wrapper";
        }

        $code .= 'class '.$this->name."\n";
        if ($this->extends != '') {
            if ($this->extendsNamespace != '') {
                $nsLastName = array_reverse(explode('\\', $this->extendsNamespace));
                $code .= "\t".'extends '.$this->classPrefix.$nsLastName[0];
                //$code = "require_once('".$this->classPrefix.implode('/', $nsLastName).".php');\n" . $code;
            } else {
                $code .= "\t".'extends '.$this->classPrefix.$this->extends."\n";
            }
        }
        $code .= "\t".'{'."\n";


        $propNames = array();
        foreach ($this->classProperties as $oneProp) {
            $propNames[] = $oneProp['name'];
        }
        $code .= ''."\n";

        $code .= "\t\t".'/**                                                                       '."\n";
        $code .= "\t\t".'* Initializes this object, optionally with pre-defined property values    '."\n";
        $code .= "\t\t".'*                                                                         '."\n";
        $code .= "\t\t".'* Initializes this object and it\'s property members, using the dictionary'."\n";
        $code .= "\t\t".'* of key/value pairs passed as an optional argument.                      '."\n";
        $code .= "\t\t".'*                                                                         '."\n";
        $code .= "\t\t".'* @param dictionary $keyValInitializers key/value pairs to be populated into object\'s properties '."\n";
        $code .= "\t\t".'* @param boolean $verbose specifies whether object should echo warnings   '."\n";
        $code .= "\t\t".'*/                                                                        '."\n";
        $code .= "\t\t".'public function __construct($keyValInitializers=array(), $verbose=FALSE)'."\n";
        $code .= "\t\t".'{'."\n";
        $code .= "\t\t\t".'foreach($keyValInitializers as $initPropName => $initPropVal)'."\n";
        $code .= "\t\t\t".'{'."\n";
        $code .= "\t\t\t\t".'if (property_exists(\''. $this->name . '\',$initPropName) || property_exists(\'QuickBooksOnline\\API\\Data\\'. $this->name . '\',$initPropName))'."\n";
        $code .= "\t\t\t\t".'{'."\n";
        $code .= "\t\t\t\t\t".'$this->{$initPropName} = $initPropVal;'."\n";
        $code .= "\t\t\t\t".'}'."\n";
        $code .= "\t\t\t\t".'else'."\n";
        $code .= "\t\t\t\t".'{'."\n";
        $code .= "\t\t\t\t\t".'if ($verbose)'."\n";
        $code .= "\t\t\t\t\t\t".'echo "Property does not exist ($initPropName) in class (".get_class($this).")'."\";\n";
        $code .= "\t\t\t\t".'}'."\n";
        $code .= "\t\t\t".'}'."\n";
        $code .= "\t\t".'}'."\n";

        $code .= ''."\n";
        if (in_array($this->type, $this->basicTypes)) {
            $code .= "\t\t".$this->getDocBlock(array('xmlType'=>'value', 'var' => $this->normalizeType($this->type)), "\t\t");
            $code .= "\t\tpublic ".'$value;';
        }

        if (!empty($this->classProperties)) {
            $code .= $this->getClassProperties($this->classProperties);
        }

        if (!empty($this->constants)) {
            $code .= $this->getClassConstants($this->constants);
        }


        $code .= ''."\n";
        $code .= ''."\n";
        $code .= '} // end class '.$this->name."\n";
        return $code;
    }
public function getPhpCode()
    {
        $code = "\n";
        if ($this->extendsNamespace != '') {
            if (false === $this->overrideAsSingleNamespace) {
                $code .= "use ".$this->extendsNamespace.";\n";
            }
        }

        if (!empty($this->classDocBlock)) {
            $code .= $this->getDocBlock($this->classDocBlock);
        }

        if ($this->name == $this->classPrefix.$this->extends) {
            $this->name = $this->name . "Wrapper";
        }

        $code .= 'class '.$this->name."\n";
        if ($this->extends != '') {
            if ($this->extendsNamespace != '') {
                $nsLastName = array_reverse(explode('\\', $this->extendsNamespace));
                $code .= "\t".'extends '.$this->classPrefix.$nsLastName[0];
                //$code = "require_once('".$this->classPrefix.implode('/', $nsLastName).".php');\n" . $code;
            } else {
                $code .= "\t".'extends '.$this->classPrefix.$this->extends."\n";
            }
        }
        $code .= "\t".'{'."\n";


        $propNames = array();
        foreach ($this->classProperties as $oneProp) {
            $propNames[] = $oneProp['name'];
        }
        $code .= ''."\n";

        $code .= "\t\t".'/**                                                                       '."\n";
        $code .= "\t\t".'* Initializes this object, optionally with pre-defined property values    '."\n";
        $code .= "\t\t".'*                                                                         '."\n";
        $code .= "\t\t".'* Initializes this object and it\'s property members, using the dictionary'."\n";
        $code .= "\t\t".'* of key/value pairs passed as an optional argument.                      '."\n";
        $code .= "\t\t".'*                                                                         '."\n";
        $code .= "\t\t".'* @param dictionary $keyValInitializers key/value pairs to be populated into object\'s properties '."\n";
        $code .= "\t\t".'* @param boolean $verbose specifies whether object should echo warnings   '."\n";
        $code .= "\t\t".'*/                                                                        '."\n";
        $code .= "\t\t".'public function __construct($keyValInitializers=array(), $verbose=FALSE)'."\n";
        $code .= "\t\t".'{'."\n";
        $code .= "\t\t\t".'foreach($keyValInitializers as $initPropName => $initPropVal)'."\n";
        $code .= "\t\t\t".'{'."\n";
        $code .= "\t\t\t\t".'if (property_exists(\''. $this->name . '\',$initPropName) || property_exists(\'QuickBooksOnline\\API\\Data\\'. $this->name . '\',$initPropName))'."\n";
        $code .= "\t\t\t\t".'{'."\n";
        $code .= "\t\t\t\t\t".'$this->{$initPropName} = $initPropVal;'."\n";
        $code .= "\t\t\t\t".'}'."\n";
        $code .= "\t\t\t\t".'else'."\n";
        $code .= "\t\t\t\t".'{'."\n";
        $code .= "\t\t\t\t\t".'if ($verbose)'."\n";
        $code .= "\t\t\t\t\t\t".'echo "Property does not exist ($initPropName) in class (".get_class($this).")'."\";\n";
        $code .= "\t\t\t\t".'}'."\n";
        $code .= "\t\t\t".'}'."\n";
        $code .= "\t\t".'}'."\n";

        $code .= ''."\n";
        if (in_array($this->type, $this->basicTypes)) {
            $code .= "\t\t".$this->getDocBlock(array('xmlType'=>'value', 'var' => $this->normalizeType($this->type)), "\t\t");
            $code .= "\t\tpublic ".'$value;';
        }

        if (!empty($this->classProperties)) {
            $code .= $this->getClassProperties($this->classProperties);
        }

        if (!empty($this->constants)) {
            $code .= $this->getClassConstants($this->constants);
        }


        $code .= ''."\n";
        $code .= ''."\n";
        $code .= '} // end class '.$this->name."\n";
        return $code;
    }
Returns array of PHP classes

@return array