Gibt die Klasse als PHP Code zurück

die Klasse ist noch nicht mit Namespace vor class notiert!
Eingerückt wird mit 2 whitespaces.
Em Ende befindet sich hinter der schließenden Klammer ein LF
199463
public function php() {
    $cr = "\n";
    
    $php = $this->phpDocBlock(0);
    
    $ms = array(self::MODIFIER_ABSTRACT => 'abstract',
                self::MODIFIER_FINAL => 'final'
               );
    
    foreach ($ms as $const => $modifier) {
      if (($const & $this->modifiers) == $const)
        $php .= $modifier.' ';
    }
    
    $php .= 'class '.$this->getClassName().' ';
    
    /* Extends */
    if (isset($this->parentClass)) {
      if ($this->parentClass->getNamespace() === $this->getNamespace()) {
        $php .= 'extends '.$this->parentClass->getClassName().' '; // don't prefix namespace
      } else {
        $php .= 'extends '.'\\'.$this->parentClass->getFQN().' ';
      }
    }
    
    /* Interfaces */
    if (count($this->getInterfaces()) > 0) {
      $php .= 'implements ';
      $that = $this;
      $php .= A::implode($this->getInterfaces(), ', ', function (GClass $iClass) use ($that) {
        if ($that->getNamespace() === $iClass->getNamespace()) {
          return $iClass->getClassName();
        } else {
          return '\\'.$iClass->getFQN();
        }
      });
      $php .= ' ';
    }
    
    $php .= '{'.$cr;
    /* Die Funktionen machen immer den Abstand nach oben. Also vor jedem Property und jeder Methode macht dies ein "\n" */

    /* Constants */
    $php .= A::joinc($this->getConstants(), '  '.$cr.'%s;'.$cr, function ($constant) {
      return $constant->php(2);
    });
    
    /* Properties */
    $php .= A::joinc($this->getProperties(), '  '.$cr.'%s;'.$cr, function ($property) {
      return $property->php(2); // hier jetzt auch wegen DocBlock einrücken
    });

    /* Methods */
    $php .= A::joinc($this->getMethods(), '  '.$cr.'%s'.$cr, function ($method) {
      return $method->php(2); // rückt selbst zwischen den Klammern ein, aber wir wollen ja den body z.b. auf 4 haben nicht auf 2
    });
    
    $php .= '}'; // kein umbruch hinten, immer abstand nach oben!
    return $php;
  }
685882
public function getNamespace()
    {
        $class       = array();
        $inNamespace = false;

        foreach ($this->tokenlist as $key => $token) {
            if (T_NAMESPACE === $token[0]) {
                $inNamespace = true;
                continue;
            }
            if (T_STRING === $token[0] && $inNamespace) {
                $class[] = $token[1];

            }
            if (';' === $token && $inNamespace) {
                return $class;
            }
        }

        return array();
    }
998280
public static function wtf($var, $arrayOfObjectsToHide = array(), $fontSize = 12)
    {
        $text = print_r($var, true);
        $text = str_replace('<', '&lt;', $text);
        $text = str_replace('>', '&gt;', $text);

        if ($var instanceof \ErrorException || $var instanceof \Exception) {
            $text = $var->getMessage() . PHP_EOL;
            $text .= PHP_EOL . 'Code: ' . $var->getCode() . ' File: ' . $var->getFile() . ':' . $var->getLine() . PHP_EOL;

            $trace = $var->getTrace();
            $first = array_shift($trace);
            $text .= PHP_EOL . 'Vars:' . PHP_EOL . PHP_EOL;
            if (isset($first['args'][4])) {
                foreach ($first['args'][4] as $var => $value) {
                    if (is_object($value)) {

                        $value = 'Instance of ' . get_class($value);
                    } else {
                        $value = print_r($value, true);
                    }

                    $text .= " $$var = $value" . PHP_EOL;

                }
            }
            $text .= PHP_EOL . 'Trace:' . PHP_EOL;
            foreach ($trace as $step => $data) {
                $class = '';
                if (isset($data["class"])) {
                    $class = $data["class"] . '->';
                }
                $line = (isset($data["line"])) ? $data["line"] : '';
                $file = (isset($data["file"])) ? $data["file"] . ':' : '';
                $fn = (isset($data["function"])) ? $data["function"] . '() ' : '';

                $text .= PHP_EOL . $step . '. ' . $class . $fn . $file . $line . PHP_EOL;
                if (isset($data['args']) && count($data['args'])) {
                    $text .= PHP_EOL . '  Vars:' . PHP_EOL;
                    foreach ($data['args'] as $arg => $val) {
                        $text .= print_r($val, true) . PHP_EOL;
                    }
                }
                unset($class);
            }
            $text = preg_replace('#(Code|File|Trace|Vars):\s#', '<span style="color: #079700;font-weight:bold;">$1:</span>', $text);
            $text = preg_replace('#(Debug|Info|Notice):\s#', '<span style="color: #079700;">$1:</span>', $text);
            $text = preg_replace('#(Warning|Error|Critical|Alert|Emergency):\s#', '<span style="color: red;">$1:</span>', $text);
            // color code object properties
            $pattern = '#\$(\w+)\s=\s(\w+)#';
            $replace = '<span style="color: #000099;">$$1</span> = ';
            $replace .= '<span style="color: #009999;">$2</span>';
            $text = preg_replace($pattern, $replace, $text);

        } else {
            foreach ($arrayOfObjectsToHide as $objectName) {
                $searchPattern = '#(\W' . $objectName . ' Object\n(\s+)\().*?\n\2\)\n#s';
                $replace = "$1<span style=\"color: #FF9900;\">";
                $replace .= "--&gt; HIDDEN - courtesy of wtf() &lt;--</span>)";
                $text = preg_replace($searchPattern, $replace, $text);
            }
            // color code objects
            $text = preg_replace('#(\w+)(\s+Object\s+\()#s', '<span style="color: #079700;">$1</span>$2', $text);
            // color code object properties
            $pattern = '#\[(\w+)\:(public|private|protected)\]#';
            $replace = '[<span style="color: #000099;">$1</span>:';
            $replace .= '<span style="color: #009999;">$2</span>]';
            $text = preg_replace($pattern, $replace, $text);
        }
        echo '<pre style="font-size: ' . $fontSize . 'px;	line-height: ' . $fontSize . 'px;background-color: #fff; padding: 10px;">' . $text . '</pre>';
    }
734097
protected function _classNode()
    {
        if (substr($this->_states['body'], -2) === '::') { // Bails out on `::class`
            $this->_states['body'] .= 'class';
            return;
        }

        $this->_codeNode();
        $token = $this->_stream->current(true);
        $body = $token[1];
        $body .= $this->_stream->skipWhitespaces();
        $body .= $name = $this->_stream->current();
        if ($name !== '{') {
            $body .= $this->_stream->next(['{', T_EXTENDS, T_IMPLEMENTS]);
        } else {
            $name = '';
        }
        $token = $this->_stream->current(true);
        $extends = '';
        $implements = '';
        if ($token[0] === T_EXTENDS) {
            $body .= $this->_stream->skipWhitespaces();
            $body .= $extends = $this->_stream->skipWhile([T_STRING, T_NS_SEPARATOR]);
            $body .= $this->_stream->current();
            if ($this->_stream->current() !== '{') {
                $body .= $this->_stream->next('{');
            }
        } elseif ($token[0] === T_IMPLEMENTS) {
            $body .= $implements = $this->_stream->next('{');
            $implements = substr($implements, 0, -1);
        }
        $node = new BlockDef($body, 'class');
        $node->name = $name;
        $node->extends = $this->_normalizeClass($extends);
        $node->implements = $this->_normalizeImplements($implements);

        $this->_states['body'] .= $body;
        return $this->_states['current'] = $this->_contextualize($node);
    }
692598
static function fr_entities_encode($s)
	{
		//$s = str_replace("&", "&amp;", $s);
		$s = str_replace("é", "&eacute;", $s);
		$s = str_replace("è", "&egrave;", $s);
		$s = str_replace("ë", "&euml;", $s);
		$s = str_replace("ê", "&ecirc;", $s);
		$s = str_replace("à", "&agrave;", $s);
		$s = str_replace("ä", "&auml;", $s);
		$s = str_replace("â", "&acirc;", $s);
		$s = str_replace("ï", "&iuml;", $s);
		$s = str_replace("î", "&icirc;", $s);
		$s = str_replace("ö", "&ouml;", $s);
		$s = str_replace("ô", "&ocirc;", $s);
		$s = str_replace("ü", "&uuml;", $s);
		$s = str_replace("û", "&ucirc;", $s);
		$s = str_replace("ù", "&ugrave;", $s);
		$s = str_replace("ç", "&ccedil;", $s);
		$s = str_replace("€", "&euro;", $s);
	
		$s = str_replace("É", "&Eacute;", $s);
		$s = str_replace("È", "&Egrave;", $s);
		$s = str_replace("Ë", "&Euml;", $s);
		$s = str_replace("Ê", "&Ecirc;", $s);
		$s = str_replace("À", "&Agrave;", $s);
		$s = str_replace("Ä", "&Auml;", $s);
		$s = str_replace("Â", "&Acirc;", $s);
		$s = str_replace("Ï", "&Iuml;", $s);
		$s = str_replace("Î", "&Icirc;", $s);
		$s = str_replace("Ö", "&Ouml;", $s);
		$s = str_replace("Ô", "&Ocirc;", $s);
		$s = str_replace("Ü", "&Uuml;", $s);
		$s = str_replace("Û", "&Ucirc;", $s);
		$s = str_replace("Ù", "&Ugrave;", $s);
		$s = str_replace("Ç", "&Ccedil;", $s);
		
		return $s;
	}
427462
public function __( $key, $params = array() )
	{
		$namespace = explode( "\\", get_called_class() );

		$class = strtolower( 'model/'.str_replace( '_', '/', array_pop( $namespace ) ) );

		$namespace = implode( "\\", $namespace );

		if ( $namespace )
		{
				$class = $namespace.'::'.$class;
		}

		return __( $class.'.label.'.$key, $params );
	}
385162
public function generateClass()
    {
        $name = $this->identifier;

        // Generate a valid classname
        $name = Validator::validateClass($name, $this->config->get('namespaceName'));

        // uppercase the name
        $name = ucfirst($name);

        // Create the class object
        $comment = new PhpDocComment($this->description);
        $this->class = new PhpClass($name, false, $this->config->get('soapClientClass'), $comment);

        // Create the constructor
        $comment = new PhpDocComment();
        $comment->addParam(PhpDocElementFactory::getParam('string', 'wsdl', 'The wsdl file to use'));
        $comment->addParam(PhpDocElementFactory::getParam('array', 'options', 'A array of config values'));

        $source = '
  foreach (self::$classmap as $key => $value) {
    if (!isset($options[\'classmap\'][$key])) {
      $options[\'classmap\'][$key] = $value;
    }
  }' . PHP_EOL;
        $source .= '  $options = array_merge(' . var_export($this->config->get('soapClientOptions'), true) . ', $options);' . PHP_EOL;
        $source .= '  if (!$wsdl) {' . PHP_EOL;
        $source .= '    $wsdl = \'' . $this->config->get('inputFile') . '\';' . PHP_EOL;
        $source .= '  }' . PHP_EOL;
        $source .= '  parent::__construct($wsdl, $options);' . PHP_EOL;

        $function = new PhpFunction('public', '__construct', 'array $options = array(), $wsdl = null', $source, $comment);

        // Add the constructor
        $this->class->addFunction($function);

        // Generate the classmap
        $name = 'classmap';
        $comment = new PhpDocComment();
        $comment->setVar(PhpDocElementFactory::getVar('array', $name, 'The defined classes'));

        $init = array();
        foreach ($this->types as $type) {
            if ($type instanceof ComplexType) {
                $init[$type->getIdentifier()] = $this->config->get('namespaceName') . "\\" . $type->getPhpIdentifier();
            }
        }
        $var = new PhpVariable('private static', $name, var_export($init, true), $comment);

        // Add the classmap variable
        $this->class->addVariable($var);

        // Add all methods
        foreach ($this->operations as $operation) {
            $name = Validator::validateOperation($operation->getName());

            $comment = new PhpDocComment($operation->getDescription());
            $comment->setReturn(PhpDocElementFactory::getReturn($operation->getReturns(), ''));

            foreach ($operation->getParams() as $param => $hint) {
                $arr = $operation->getPhpDocParams($param, $this->types);
                $comment->addParam(PhpDocElementFactory::getParam($arr['type'], $arr['name'], $arr['desc']));
            }

            $source = '  return $this->__soapCall(\'' . $operation->getName() . '\', array(' . $operation->getParamStringNoTypeHints() . '));' . PHP_EOL;

            $paramStr = $operation->getParamString($this->types);

            $function = new PhpFunction('public', $name, $paramStr, $source, $comment);

            if ($this->class->functionExists($function->getIdentifier()) == false) {
                $this->class->addFunction($function);
            }
        }
    }
1183287
function rel2absSeg(jPath,ind) {
        
        var seg = jPath.getSeg(ind),
        letter = seg.pathSegTypeAsLetter.toLowerCase(),
        args,ref;
        
        if (seg.pathSegTypeAsLetter !== letter) return; //déjà en absolu
        
        args = [ind,letter.toUpperCase()];
        ref = jPath.getCurPt(ind);
        
        if (letter === 'h') args.push(ref.x+seg.x);
        else if (letter === 'v') args.push(ref.y+seg.y);
        else if (letter === "m") args.push(seg.x,seg.y);
        else if (letter !== "z") {
            
            args.push(ref.x+seg.x,ref.y+seg.y);
            
            switch (letter) {
                case 'c' : args.push(ref.x+seg.x1,ref.y+seg.y1,ref.x+seg.x2,ref.y+seg.y2); break;
                case 'q' : args.push(ref.x+seg.x1,ref.y+seg.y1); break;
                case 'a' : args.push(seg.r1,seg.r2,seg.angle,seg.largArcFlag,seg.sweepFlag); break;
                case 's' : args.push(ref.x+seg.x2,ref.y+seg.y2); break;
            }
        }
        
        jPath.replaceSeg.apply(jPath,args);
    }
940800
function schemaStartElement($parser, $name, $attrs)
    {

        // position in the total number of elements, starting from 0
        $pos   = $this->position++;
        $depth = $this->depth++;
        // set self as current value for this depth
        $this->depth_array[$depth] = $pos;
        $this->message[$pos]       = ['cdata' => ''];
        if ($depth > 0) {
            $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]];
        } else {
            $this->defaultNamespace[$pos] = FALSE;
        }

        // get element prefix
        if ($prefix = $this->getPrefix($name)) {
            // get unqualified name
            $name = $this->getLocalPart($name);
        } else {
            $prefix = '';
        }

        // loop thru attributes, expanding, and registering namespace declarations
        if (count($attrs) > 0) {
            foreach ($attrs as $k => $v) {
                // if ns declarations, add to class level array of valid namespaces
                if (preg_match('/^xmlns/', $k)) {
                    //$this->xdebug("$k: $v");
                    //$this->xdebug('ns_prefix: '.$this->getPrefix($k));
                    if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
                        //$this->xdebug("Add namespace[$ns_prefix] = $v");
                        $this->namespaces[$ns_prefix] = $v;
                    } else {
                        $this->defaultNamespace[$pos] = $v;
                        if (!$this->getPrefixFromNamespace($v)) {
                            $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
                        }
                    }
                    if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
                        $this->XMLSchemaVersion  = $v;
                        $this->namespaces['xsi'] = $v . '-instance';
                    }
                }
            }
            foreach ($attrs as $k => $v) {
                // expand each attribute
                $k          = strpos($k, ':') ? $this->expandQname($k) : $k;
                $v          = strpos($v, ':') ? $this->expandQname($v) : $v;
                $eAttrs[$k] = $v;
            }
            $attrs = $eAttrs;
        } else {
            $attrs = [];
        }
        // find status, register data
        switch ($name) {
            case 'all':            // (optional) compositor content for a complexType
            case 'choice':
            case 'group':
            case 'sequence':
                //$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement");
                $this->complexTypes[$this->currentComplexType]['compositor'] = $name;
                //if($name == 'all' || $name == 'sequence'){
                //	$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
                //}
                break;
            case 'attribute':    // complexType attribute
                //$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']);
                $this->xdebug("parsing attribute:");
                $this->appendDebug($this->varDump($attrs));
                if (!isset($attrs['form'])) {
                    // TODO: handle globals
                    $attrs['form'] = $this->schemaInfo['attributeFormDefault'];
                }
                if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
                    $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
                    if (!strpos($v, ':')) {
                        // no namespace in arrayType attribute value...
                        if ($this->defaultNamespace[$pos]) {
                            // ...so use the default
                            $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
                        }
                    }
                }
                if (isset($attrs['name'])) {
                    $this->attributes[$attrs['name']] = $attrs;
                    $aname                            = $attrs['name'];
                } elseif (isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType') {
                    if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
                        $aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
                    } else {
                        $aname = '';
                    }
                } elseif (isset($attrs['ref'])) {
                    $aname                           = $attrs['ref'];
                    $this->attributes[$attrs['ref']] = $attrs;
                }

                if ($this->currentComplexType) {    // This should *always* be
                    $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs;
                }
                // arrayType attribute
                if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType') {
                    $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
                    $prefix                                                   = $this->getPrefix($aname);
                    if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
                        $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
                    } else {
                        $v = '';
                    }
                    if (strpos($v, '[,]')) {
                        $this->complexTypes[$this->currentComplexType]['multidimensional'] = TRUE;
                    }
                    $v = substr($v, 0, strpos($v, '[')); // clip the []
                    if (!strpos($v, ':') && isset($this->typemap[$this->XMLSchemaVersion][$v])) {
                        $v = $this->XMLSchemaVersion . ':' . $v;
                    }
                    $this->complexTypes[$this->currentComplexType]['arrayType'] = $v;
                }
                break;
            case 'complexContent':    // (optional) content for a complexType
                $this->xdebug("do nothing for element $name");
                break;
            case 'complexType':
                array_push($this->complexTypeStack, $this->currentComplexType);
                if (isset($attrs['name'])) {
                    // TODO: what is the scope of named complexTypes that appear
                    //       nested within other c complexTypes?
                    $this->xdebug('processing named complexType ' . $attrs['name']);
                    //$this->currentElement = false;
                    $this->currentComplexType                                   = $attrs['name'];
                    $this->complexTypes[$this->currentComplexType]              = $attrs;
                    $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
                    // This is for constructs like
                    //           <complexType name="ListOfString" base="soap:Array">
                    //                <sequence>
                    //                    <element name="string" type="xsd:string"
                    //                        minOccurs="0" maxOccurs="unbounded" />
                    //                </sequence>
                    //            </complexType>
                    if (isset($attrs['base']) && preg_match('/:Array$/', $attrs['base'])) {
                        $this->xdebug('complexType is unusual array');
                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
                    } else {
                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
                    }
                } else {
                    $name = $this->CreateTypeName($this->currentElement);
                    $this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name);
                    $this->currentComplexType = $name;
                    //$this->currentElement = false;
                    $this->complexTypes[$this->currentComplexType]              = $attrs;
                    $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
                    // This is for constructs like
                    //           <complexType name="ListOfString" base="soap:Array">
                    //                <sequence>
                    //                    <element name="string" type="xsd:string"
                    //                        minOccurs="0" maxOccurs="unbounded" />
                    //                </sequence>
                    //            </complexType>
                    if (isset($attrs['base']) && preg_match('/:Array$/', $attrs['base'])) {
                        $this->xdebug('complexType is unusual array');
                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
                    } else {
                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
                    }
                }
                $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'false';
                break;
            case 'element':
                array_push($this->elementStack, $this->currentElement);
                if (!isset($attrs['form'])) {
                    if ($this->currentComplexType) {
                        $attrs['form'] = $this->schemaInfo['elementFormDefault'];
                    } else {
                        // global
                        $attrs['form'] = 'qualified';
                    }
                }
                if (isset($attrs['type'])) {
                    $this->xdebug("processing typed element " . $attrs['name'] . " of type " . $attrs['type']);
                    if (!$this->getPrefix($attrs['type'])) {
                        if ($this->defaultNamespace[$pos]) {
                            $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type'];
                            $this->xdebug('used default namespace to make type ' . $attrs['type']);
                        }
                    }
                    // This is for constructs like
                    //           <complexType name="ListOfString" base="soap:Array">
                    //                <sequence>
                    //                    <element name="string" type="xsd:string"
                    //                        minOccurs="0" maxOccurs="unbounded" />
                    //                </sequence>
                    //            </complexType>
                    if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') {
                        $this->xdebug('arrayType for unusual array is ' . $attrs['type']);
                        $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type'];
                    }
                    $this->currentElement = $attrs['name'];
                    $ename                = $attrs['name'];
                } elseif (isset($attrs['ref'])) {
                    $this->xdebug("processing element as ref to " . $attrs['ref']);
                    $this->currentElement = "ref to " . $attrs['ref'];
                    $ename                = $this->getLocalPart($attrs['ref']);
                } else {
                    $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']);
                    $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type);
                    $this->currentElement = $attrs['name'];
                    $attrs['type']        = $this->schemaTargetNamespace . ':' . $type;
                    $ename                = $attrs['name'];
                }
                if (isset($ename) && $this->currentComplexType) {
                    $this->xdebug("add element $ename to complexType $this->currentComplexType");
                    $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs;
                } elseif (!isset($attrs['ref'])) {
                    $this->xdebug("add element $ename to elements array");
                    $this->elements[$attrs['name']]              = $attrs;
                    $this->elements[$attrs['name']]['typeClass'] = 'element';
                }
                break;
            case 'enumeration':    //	restriction value list member
                $this->xdebug('enumeration ' . $attrs['value']);
                if ($this->currentSimpleType) {
                    $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value'];
                } elseif ($this->currentComplexType) {
                    $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value'];
                }
                break;
            case 'extension':    // simpleContent or complexContent type extension
                $this->xdebug('extension ' . $attrs['base']);
                if ($this->currentComplexType) {
                    $ns = $this->getPrefix($attrs['base']);
                    if ($ns == '') {
                        $this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base'];
                    } else {
                        $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base'];
                    }
                } else {
                    $this->xdebug('no current complexType to set extensionBase');
                }
                break;
            case 'import':
                if (isset($attrs['schemaLocation'])) {
                    $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']);
                    $this->imports[$attrs['namespace']][] = ['location' => $attrs['schemaLocation'], 'loaded' => FALSE];
                } else {
                    $this->xdebug('import namespace ' . $attrs['namespace']);
                    $this->imports[$attrs['namespace']][] = ['location' => '', 'loaded' => TRUE];
                    if (!$this->getPrefixFromNamespace($attrs['namespace'])) {
                        $this->namespaces['ns' . (count($this->namespaces) + 1)] = $attrs['namespace'];
                    }
                }
                break;
            case 'include':
                if (isset($attrs['schemaLocation'])) {
                    $this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']);
                    $this->imports[$this->schemaTargetNamespace][] = ['location' => $attrs['schemaLocation'], 'loaded' => FALSE];
                } else {
                    $this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute');
                }
                break;
            case 'list':    // simpleType value list
                $this->xdebug("do nothing for element $name");
                break;
            case 'restriction':    // simpleType, simpleContent or complexContent value restriction
                $this->xdebug('restriction ' . $attrs['base']);
                if ($this->currentSimpleType) {
                    $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base'];
                } elseif ($this->currentComplexType) {
                    $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base'];
                    if (strstr($attrs['base'], ':') == ':Array') {
                        $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
                    }
                }
                break;
            case 'schema':
                $this->schemaInfo                  = $attrs;
                $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix);
                if (isset($attrs['targetNamespace'])) {
                    $this->schemaTargetNamespace = $attrs['targetNamespace'];
                }
                if (!isset($attrs['elementFormDefault'])) {
                    $this->schemaInfo['elementFormDefault'] = 'unqualified';
                }
                if (!isset($attrs['attributeFormDefault'])) {
                    $this->schemaInfo['attributeFormDefault'] = 'unqualified';
                }
                break;
            case 'simpleContent':    // (optional) content for a complexType
                if ($this->currentComplexType) {    // This should *always* be
                    $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'true';
                } else {
                    $this->xdebug("do nothing for element $name because there is no current complexType");
                }
                break;
            case 'simpleType':
                array_push($this->simpleTypeStack, $this->currentSimpleType);
                if (isset($attrs['name'])) {
                    $this->xdebug("processing simpleType for name " . $attrs['name']);
                    $this->currentSimpleType                        = $attrs['name'];
                    $this->simpleTypes[$attrs['name']]              = $attrs;
                    $this->simpleTypes[$attrs['name']]['typeClass'] = 'simpleType';
                    $this->simpleTypes[$attrs['name']]['phpType']   = 'scalar';
                } else {
                    $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement);
                    $this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name);
                    $this->currentSimpleType = $name;
                    //$this->currentElement = false;
                    $this->simpleTypes[$this->currentSimpleType]            = $attrs;
                    $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar';
                }
                break;
            case 'union':    // simpleType type list
                $this->xdebug("do nothing for element $name");
                break;
            default:
                $this->xdebug("do not have any logic to process element $name");
        }
    }
1232142
function queryShare($token, $buyOrder, $shareNumber) {

        try {

            $queryShare = new queryShare();

            $queryShare->token = $token;
            $queryShare->buyOrder = $buyOrder;
            $queryShare->shareNumber = $shareNumber;

            $queryShareResponse = $this->_queryShare($queryShare);

            $xmlResponse = $this->soapClient->__getLastResponse();
            $soapValidation = new SoapValidation($xmlResponse, $this->config->getWebpayCert());
            $validationResult = $soapValidation->getValidationResult();

            if ($validationResult === TRUE) {

                $wsCompleteQuerySharesOutput = $queryShareResponse->return;
                return $wsCompleteQuerySharesOutput;

            } else {

                $error["error"] = "Error validando conexi&oacute;n a Webpay (Verificar que la informaci&oacute;n del certificado sea correcta)";
                $error["detail"] = "No se pudo completar la conexi&oacute;n con Webpay";

            }
        } catch (Exception $e) {

            $error["error"] = "Error conectando a Webpay (Verificar que la informaci&oacute;n del certificado sea correcta)";

            $replaceArray = array('<!--' => '', '-->' => '');
            $error["detail"] = str_replace(array_keys($replaceArray), array_values($replaceArray), $e->getMessage());
        }

        return $error;
    }
238879
protected function parseData()
    {
        if (is_null($this->dataCache)) {
            $patternNamespace  = '(?P<namespace>[a-zA-Z0-9\\\\]+\\\\)?';
            $patternName       = '(?P<name>[a-zA-Z0-9]+)';
            $patternString     = '\"[^\"]*\"|\'[^\']*\'';
            $patternFloat      = '[0-9]+\.[0-9]+';
            $patternInt        = '[0-9]+';
            $patternBool       = 'true|false';
            $patternAttrValues = "({$patternString}|{$patternFloat}|{$patternInt}|{$patternBool})";
            $patternAttributes = "(?P<attr>\(\s*([a-zA-Z0-9]+\={$patternAttrValues}\s*\,?\s*)+\s*\))?";
            $pattern           = "^\@{$patternNamespace}{$patternName}\s*{$patternAttributes}(?P<rawtext>.*)$";
            
            if (preg_match("/{$pattern}/is", $this->getValue(), $matches)) {
                $this->dataCache = array(
                    'namespace'   => $matches['namespace'],
                    'name'        => $matches['name'],
                    'attributes'  => array(),
                    'tags'        => array(),
                );
                
                if (preg_match_all("/(?P<key>[a-zA-Z0-9]+)\s*\=\s*(?P<value>{$patternAttrValues})/is", $matches['attr'], $attributeMatches, PREG_SET_ORDER)) {
                    foreach ($attributeMatches as $attributeMatch) {
                        $key   = $attributeMatch['key'];
                        $value = $attributeMatch['value'];
                        switch(true){
                            case $value === 'true':
                                $value = true;
                                break;
                                
                            case $value === 'false':
                                $value = false;
                                break;
                                
                            case $value[0] === '"':
                            case $value[0] === "'":
                                $value = substr($value, 1, strlen($value)-2);
                                break;
                                
                            case strpos($value, '.')>0:
                                $value = (float)$value;
                                break;
                                
                            case is_numeric($value):
                                $value = (int)$value;
                                break;
                                
                        }
                        $this->dataCache['attributes'][$key] = $value;
                    }
                }
                
                foreach (preg_split("/\s+/is", trim($matches['rawtext'])) as $attributeTag) {
                    $this->dataCache['tags'][] = $attributeTag;
                }
            }
        }
        return $this->dataCache;
    }
85964
public function minimise(): Utility
    {
        // remove redundant (white-space) characters
        $replace = [
            // remove tabs before and after HTML tags
            '/\>[^\S ]+/s' => '>',
            '/[^\S ]+\</s' => '<',
            // shorten multiple whitespace sequences; keep new-line characters because they matter in JS!!!
            '/([\t ])+/s' => ' ',
            // remove leading and trailing spaces
            '/^([\t ])+/m' => '',
            '/([\t ])+$/m' => '',
            // remove JS line comments (simple only);
            // do NOT remove lines containing URL (e.g. 'src="http://server.com/"')!!!
            '~//[a-zA-Z0-9 ]+$~m' => '',
            // remove empty lines (sequence of line-end and white-space characters)
            '/[\r\n]+([\t ]?[\r\n]+)+/s' => "\n",
            // remove empty lines (between HTML tags);
            // cannot remove just any line-end characters because in inline JS they can matter!
            '/\>[\r\n\t ]+\</s' => '><',
            // remove "empty" lines containing only JS's block end character;
            // join with next line (e.g. "}\n}\n</script>" --> "}}</script>"
            '/}[\r\n\t ]+/s' => '}',
            '/}[\r\n\t ]+,[\r\n\t ]+/s' => '},',
            // remove new-line after JS's function or condition start; join with next line
            '/\)[\r\n\t ]?{[\r\n\t ]+/s' => '){',
            '/,[\r\n\t ]?{[\r\n\t ]+/s' => ',{',
            // remove new-line after JS's line end (only most obvious and safe cases)
            '/\),[\r\n\t ]+/s' => '),',
            // remove quotes from HTML attributes that does not contain spaces; keep quotes around URLs!
            '~([\r\n\t ])?([a-zA-Z0-9]+)="([a-zA-Z0-9_/\\-]+)"([\r\n\t ])?~s' => '$1$2=$3$4',
            // $1 and $4 insert first white-space character found before/after attribute
            '!/\*[^*]*\*+([^/][^*]*\*+)*/!' => '',
            // Remove comments
        ];

        $string = preg_replace(array_keys($replace), array_values($replace), $this->string);

        $remove = ['</option>', '</li>', '</dt>', '</dd>', '</tr>', '</th>', '</td>'];

        // remove optional ending tags (see http://www.w3.org/TR/html5/syntax.html#syntax-tag-omission )
        $string = str_ireplace($remove, '', $string);
        // remove tabs
        $string = str_replace("\t", ' ', $string);
        // remove new lines
        $string = str_replace("\n", ' ', $string);
        // remove carriage returns
        $string = str_replace("\r", ' ', $string);

        $string = trim(preg_replace('/[\s\t\n\r\s]+/', ' ', $string));

        return new static($string, $this->encoding);
    }
99676
function translate_code(PHP_ParserGenerator_Rule $rp)
    {
        $lhsused = 0;    /* True if the LHS element has been used */
        $used = array();   /* True for each RHS element which is used */
        
        $this->append_str('', 0);
        for ($i = 0; $i < strlen($rp->code); $i++) {
            $cp = $rp->code[$i];
            if (preg_match('/[A-Za-z]/', $cp) &&
                 ($i === 0 || (!preg_match('/[A-Za-z0-9_]/', $rp->code[$i - 1])))) {
                //*xp = 0;
                // previous line is in essence a temporary substr, so
                // we will simulate it
                $test = substr($rp->code, $i);
                preg_match('/[A-Za-z0-9_]+/', $test, $matches);
                $tempcp = $matches[0];
                $j = strlen($tempcp) + $i;
                if ($rp->lhsalias && $tempcp == $rp->lhsalias) {
                    $this->append_str("\$this->_retvalue", 0);
                    $cp = $rp->code[$j];
                    $i = $j;
                    $lhsused = 1;
                } else {
                    for ($ii = 0; $ii < $rp->nrhs; $ii++) {
                        if ($rp->rhsalias[$ii] && $tempcp == $rp->rhsalias[$ii]) {
                            if ($rp->code[0] == '@') {
                                /* If the argument is of the form @X then substitute
                                ** the token number of X, not the value of X */
                                $this->append_str("\$this->yystack[\$this->yyidx + " .
                                    ($ii - $rp->nrhs + 1) . "]->major", -1);
                            } else {
                                $sp = $rp->rhs[$ii];
                                if ($sp->type == PHP_ParserGenerator_Symbol::MULTITERMINAL) {
                                    $dtnum = $sp->subsym[0]->dtnum;
                                } else {
                                    $dtnum = $sp->dtnum;
                                }
                                $this->append_str("\$this->yystack[\$this->yyidx + " .
                                    ($ii - $rp->nrhs + 1) . "]->minor", 0);
                            }
                            $cp = $rp->code[$j];
                            $i = $j;
                            $used[$ii] = 1;
                            break;
                        }
                    }
                }
            }
            $this->append_str($cp, 1);
        } /* End loop */
        
        /* Check to make sure the LHS has been used */
        if ($rp->lhsalias && !$lhsused) {
            PHP_ParserGenerator::ErrorMsg($this->filename, $rp->ruleline,
                "Label \"%s\" for \"%s(%s)\" is never used.",
                $rp->lhsalias, $rp->lhs->name, $rp->lhsalias);
                $this->errorcnt++;
        }
        
        /* Generate destructor code for RHS symbols which are not used in the
        ** reduce code */
        for($i = 0; $i < $rp->nrhs; $i++) {
            if ($rp->rhsalias[$i] && !isset($used[$i])) {
                PHP_ParserGenerator::ErrorMsg($this->filename, $rp->ruleline,
                    "Label %s for \"%s(%s)\" is never used.",
                    $rp->rhsalias[$i], $rp->rhs[$i]->name, $rp->rhsalias[$i]);
                $this->errorcnt++;
            } elseif ($rp->rhsalias[$i] == 0) {
                if ($rp->rhs[$i]->type == PHP_ParserGenerator_Symbol::TERMINAL) {
                    $hasdestructor = $this->tokendest != 0;
                }else{
                    $hasdestructor = $this->vardest !== 0 || $rp->rhs[$i]->destructor !== 0;
                }
                if ($hasdestructor) {
                    $this->append_str("  \$this->yy_destructor(" .
                        ($rp->rhs[$i]->index) . ", \$this->yystack[\$this->yyidx + " .
                        ($i - $rp->nrhs + 1) . "]->minor);\n", 0);
                } else {
                    /* No destructor defined for this term */
                }
            }
        }
        $cp = $this->append_str('', 0);
        $rp->code = $cp;
    }
1326943
static public function findClass($name, $type=null, $namespaces=null)
	{
	    $name = StringHelper::toClassName($name);
	    if (!$namespaces && strpos($name, '\\') !== false && class_exists($name)) {
	        return $name;
	    }
	    
	    $class_names = [];
	    if (!empty($type)) {
	        $type = StringHelper::toCamelCase($type);
	        if ($pos = strpos($name, '\\')) {
	            $class_names[] = $type . '\\' . $name . $type;
	            $class_names[] = $type . '\\' . $name;
	            
	            $name = substr($name, 0, $pos) . '\\' . $type . '\\' . substr($name, $pos+1);
	        } else {
	            $name = $type . '\\' . $name;
	        }
	        $class_names[] = $name;
	        $class_names[] = $name . $type;
		} else {
		    $class_names[] = $name;
		}
		
		if ($namespaces) {
            $namespaces = (array)static::formatNamespace($namespaces);
		} else {
            //$namespaces = array_unique(array_merge((array)$namespaces, static::getNamespaces()));
		    $namespaces = static::getNamespaces();
		}
		
		foreach ($namespaces as $nss) {
		    foreach ($class_names as $class) { 
		        if (class_exists($nss . $class)) {
		            return $nss . $class;
		        }
		    }
		}
		
		return null;
	}
1049005
public function toNamespacedString($namespace, array $aliased_classes, $this_class, $use_phpdoc_format)
    {
        if ($use_phpdoc_format) {
            if ($this instanceof TNamedObject) {
                return parent::toNamespacedString($namespace, $aliased_classes, $this_class, true);
            }

            return $this->value;
        }

        $param_string = '';
        $return_type_string = '';

        if ($this->params !== null) {
            $param_string = '(' . implode(
                ', ',
                array_map(
                    /**
                     * @return string
                     */
                    function (FunctionLikeParameter $param) use ($namespace, $aliased_classes, $this_class) {
                        if (!$param->type) {
                            $type_string = 'mixed';
                        } else {
                            $type_string = $param->type->toNamespacedString(
                                $namespace,
                                $aliased_classes,
                                $this_class,
                                false
                            );
                        }

                        return ($param->is_variadic ? '...' : '') . $type_string . ($param->is_optional ? '=' : '');
                    },
                    $this->params
                )
            ) . ')';
        }

        if ($this->return_type !== null) {
            $return_type_multiple = count($this->return_type->getTypes()) > 1;

            $return_type_string = ':' . ($return_type_multiple ? '(' : '') . $this->return_type->toNamespacedString(
                $namespace,
                $aliased_classes,
                $this_class,
                false
            ) . ($return_type_multiple ? ')' : '');
        }

        if ($this instanceof TNamedObject) {
            return parent::toNamespacedString($namespace, $aliased_classes, $this_class, true)
                . $param_string . $return_type_string;
        }

        return 'callable' . $param_string . $return_type_string;
    }
46100
function WriteBarcode($code, $showtext = 1, $x = '', $y = '', $size = 1, $border = 0, $paddingL = 1, $paddingR = 1, $paddingT = 2, $paddingB = 2, $height = 1, $bgcol = false, $col = false, $btype = 'ISBN', $supplement = '0', $supplement_code = '', $k = 1)
	{
		if (empty($code)) {
			return;
		}

		$codestr = $code;
		$code = preg_replace('/\-/', '', $code);

		$this->barcode = new Barcode();
		if ($btype == 'ISSN' || $btype == 'ISBN') {
			$arrcode = $this->barcode->getBarcodeArray($code, 'EAN13');
		} else {
			$arrcode = $this->barcode->getBarcodeArray($code, $btype);
		}

		if ($arrcode === false) {
			throw new \Mpdf\MpdfException('Error in barcode string: ' . $codestr);
		}

		if ((($btype === 'EAN13' || $btype === 'ISBN' || $btype === 'ISSN') && strlen($code) === 12)
				|| ($btype == 'UPCA' && strlen($code) === 11)
				|| ($btype == 'UPCE' && strlen($code) === 11)
				|| ($btype == 'EAN8' && strlen($code) === 7)) {

			$code .= $arrcode['checkdigit'];

			if (stristr($codestr, '-')) {
				$codestr .= '-' . $arrcode['checkdigit'];
			} else {
				$codestr .= $arrcode['checkdigit'];
			}
		}

		if ($btype === 'ISBN') {
			$codestr = 'ISBN ' . $codestr;
		}

		if ($btype === 'ISSN') {
			$codestr = 'ISSN ' . $codestr;
		}

		if (empty($x)) {
			$x = $this->x;
		}

		if (empty($y)) {
			$y = $this->y;
		}

		// set foreground color
		$prevDrawColor = $this->DrawColor;
		$prevTextColor = $this->TextColor;
		$prevFillColor = $this->FillColor;

		$lw = $this->LineWidth;
		$this->SetLineWidth(0.01);

		$size /= $k; // in case resized in a table

		$xres = $arrcode['nom-X'] * $size;
		$llm = $arrcode['lightmL'] * $arrcode['nom-X'] * $size; // Left Light margin
		$rlm = $arrcode['lightmR'] * $arrcode['nom-X'] * $size; // Right Light margin

		$bcw = ($arrcode["maxw"] * $xres); // Barcode width = Should always be 31.35mm * $size

		$fbw = $bcw + $llm + $rlm; // Full barcode width incl. light margins
		$ow = $fbw + $paddingL + $paddingR; // Full overall width incl. user-defined padding

		$fbwi = $fbw - 2; // Full barcode width incl. light margins - 2mm - for isbn string
		// cf. http://www.gs1uk.org/downloads/bar_code/Bar coding getting it right.pdf
		$num_height = 3 * $size;     // Height of numerals
		$fbh = $arrcode['nom-H'] * $size * $height;  // Full barcode height incl. numerals
		$bch = $fbh - (1.5 * $size);     // Barcode height of bars	 (3mm for numerals)

		if (($btype == 'EAN13' && $showtext) || $btype == 'ISSN' || $btype == 'ISBN') { // Add height for ISBN string + margin from top of bars
			$tisbnm = 1.5 * $size; // Top margin between isbn (if shown) & bars
			$codestr_fontsize = 2.1 * $size;
			$paddingT += $codestr_fontsize + $tisbnm;
		}

		$oh = $fbh + $paddingT + $paddingB;  // Full overall height incl. user-defined padding

		// PRINT border background color
		$xpos = $x;
		$ypos = $y;

		if ($col) {
			$this->SetDColor($col);
			$this->SetTColor($col);
		} else {
			$this->SetDColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
			$this->SetTColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
		}

		if ($bgcol) {
			$this->SetFColor($bgcol);
		} else {
			$this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
		}

		if (!$bgcol && !$col) { // fn. called directly - not via HTML

			if ($border) {
				$fillb = 'DF';
			} else {
				$fillb = 'F';
			}

			$this->Rect($xpos, $ypos, $ow, $oh, $fillb);
		}


		// PRINT BARS
		$xpos = $x + $paddingL + $llm;
		$ypos = $y + $paddingT;

		if ($col) {
			$this->SetFColor($col);
		} else {
			$this->SetFColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
		}

		if ($arrcode !== false) {
			foreach ($arrcode["bcode"] as $v) {
				$bw = ($v["w"] * $xres);
				if ($v["t"]) {
					// draw a vertical bar
					$this->Rect($xpos, $ypos, $bw, $bch, 'F');
				}
				$xpos += $bw;
			}
		}

		// print text
		$prevFontFamily = $this->FontFamily;
		$prevFontStyle = $this->FontStyle;
		$prevFontSizePt = $this->FontSizePt;

		// ISBN string
		if (($btype === 'EAN13' && $showtext) || $btype === 'ISBN' || $btype === 'ISSN') {

			if ($this->onlyCoreFonts) {
				$this->SetFont('chelvetica');
			} else {
				$this->SetFont('sans');
			}

			if ($bgcol) {
				$this->SetFColor($bgcol);
			} else {
				$this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
			}

			$this->x = $x + $paddingL + 1; // 1mm left margin (cf. $fbwi above)

			// max width is $fbwi
			$loop = 0;
			while ($loop == 0) {
				$this->SetFontSize($codestr_fontsize * 1.4 * Mpdf::SCALE, false); // don't write
				$sz = $this->GetStringWidth($codestr);

				if ($sz > $fbwi) {
					$codestr_fontsize -= 0.1;
				} else {
					$loop ++;
				}
			}

			$this->SetFont('', '', $codestr_fontsize * 1.4 * Mpdf::SCALE, true, true); // * 1.4 because font height is only 7/10 of given mm
			// WORD SPACING
			if ($fbwi > $sz) {
				$xtra = $fbwi - $sz;
				$charspacing = $xtra / (strlen($codestr) - 1);
				if ($charspacing) {
					$this->writer->write(sprintf('BT %.3F Tc ET', $charspacing * Mpdf::SCALE));
				}
			}

			$this->y = $y + $paddingT - ($codestr_fontsize ) - $tisbnm;
			$this->Cell($fbw, $codestr_fontsize, $codestr);

			if ($charspacing) {
				$this->writer->write('BT 0 Tc ET');
			}
		}


		// Bottom NUMERALS
		// mPDF 5.7.4
		if ($this->onlyCoreFonts) {
			$this->SetFont('ccourier');
			$fh = 1.3;
		} else {
			$this->SetFont('ocrb');
			$fh = 1.06;
		}

		$charRO = '';

		if ($btype === 'EAN13' || $btype === 'ISBN' || $btype === 'ISSN') {

			$outerfontsize = 3; // Inner fontsize = 3
			$outerp = $xres * 4;
			$innerp = $xres * 2.5;
			$textw = ($bcw * 0.5) - $outerp - $innerp;
			$chars = 6; // number of numerals in each half
			$charLO = substr($code, 0, 1); // Left Outer
			$charLI = substr($code, 1, 6); // Left Inner
			$charRI = substr($code, 7, 6); // Right Inner

			if (!$supplement) {
				$charRO = '>'; // Right Outer
			}

		} elseif ($btype === 'UPCA') {

			$outerfontsize = 2.3; // Inner fontsize = 3
			$outerp = $xres * 10;
			$innerp = $xres * 2.5;
			$textw = ($bcw * 0.5) - $outerp - $innerp;
			$chars = 5;
			$charLO = substr($code, 0, 1); // Left Outer
			$charLI = substr($code, 1, 5); // Left Inner
			$charRI = substr($code, 6, 5); // Right Inner
			$charRO = substr($code, 11, 1); // Right Outer

		} elseif ($btype === 'UPCE') {

			$outerfontsize = 2.3; // Inner fontsize = 3
			$outerp = $xres * 4;
			$innerp = 0;
			$textw = ($bcw * 0.5) - $outerp - $innerp;
			$chars = 3;
			$upce_code = $arrcode['code'];
			$charLO = substr($code, 0, 1); // Left Outer
			$charLI = substr($upce_code, 0, 3); // Left Inner
			$charRI = substr($upce_code, 3, 3); // Right Inner
			$charRO = substr($code, 11, 1); // Right Outer

		} elseif ($btype === 'EAN8') {

			$outerfontsize = 3; // Inner fontsize = 3
			$outerp = $xres * 4;
			$innerp = $xres * 2.5;
			$textw = ($bcw * 0.5) - $outerp - $innerp;
			$chars = 4;
			$charLO = '<'; // Left Outer
			$charLI = substr($code, 0, 4); // Left Inner
			$charRI = substr($code, 4, 4); // Right Inner

			if (!$supplement) {
				$charRO = '>'; // Right Outer
			}
		}

		$this->SetFontSize(($outerfontsize / 3) * 3 * $fh * $size * Mpdf::SCALE); // 3mm numerals (FontSize is larger to account for space above/below characters)

		if (!$this->usingCoreFont) { // character width at 3mm
			$cw = $this->_getCharWidth($this->CurrentFont['cw'], 32) * 3 * $fh * $size / 1000;
		} else {
			$cw = 600 * 3 * $fh * $size / 1000;
		}

		// Outer left character
		$y_text = $y + $paddingT + $bch - ($num_height / 2);
		$y_text_outer = $y + $paddingT + $bch - ($num_height * ($outerfontsize / 3) / 2);

		$this->x = $x + $paddingL - ($cw * ($outerfontsize / 3) * 0.1); // 0.1 is correction as char does not fill full width;
		$this->y = $y_text_outer;
		$this->Cell($cw, $num_height, $charLO);

		// WORD SPACING for inner chars
		$xtra = $textw - ($cw * $chars);
		$charspacing = $xtra / ($chars - 1);
		if ($charspacing) {
			$this->writer->write(sprintf('BT %.3F Tc ET', $charspacing * Mpdf::SCALE));
		}

		if ($bgcol) {
			$this->SetFColor($bgcol);
		} else {
			$this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
		}

		$this->SetFontSize(3 * $fh * $size * Mpdf::SCALE); // 3mm numerals (FontSize is larger to account for space above/below characters)

		// Inner left half characters
		$this->x = $x + $paddingL + $llm + $outerp;
		$this->y = $y_text;
		$this->Cell($textw, $num_height, $charLI, 0, 0, '', 1);

		// Inner right half characters
		$this->x = $x + $paddingL + $llm + ($bcw * 0.5) + $innerp;
		$this->y = $y_text;
		$this->Cell($textw, $num_height, $charRI, 0, 0, '', 1);

		if ($charspacing) {
			$this->writer->write('BT 0 Tc ET');
		}

		// Outer Right character
		$this->SetFontSize(($outerfontsize / 3) * 3 * $fh * $size * Mpdf::SCALE); // 3mm numerals (FontSize is larger to account for space above/below characters)

		$this->x = $x + $paddingL + $llm + $bcw + $rlm - ($cw * ($outerfontsize / 3) * 0.9); // 0.9 is correction as char does not fill full width
		$this->y = $y_text_outer;
		$this->Cell($cw * ($outerfontsize / 3), $num_height, $charRO, 0, 0, 'R');

		if ($supplement) { // EAN-2 or -5 Supplement
			// PRINT BARS
			$supparrcode = $this->barcode->getBarcodeArray($supplement_code, 'EAN' . $supplement);

			if ($supparrcode === false) {
				throw new \Mpdf\MpdfException('Error in barcode string (supplement): ' . $codestr . ' ' . $supplement_code);
			}

			if (strlen($supplement_code) != $supplement) {
				throw new \Mpdf\MpdfException('Barcode supplement incorrect: ' . $supplement_code);
			}

			$llm = $fbw - (($arrcode['lightmR'] - $supparrcode['sepM']) * $arrcode['nom-X'] * $size); // Left Light margin
			$rlm = $arrcode['lightmR'] * $arrcode['nom-X'] * $size; // Right Light margin

			$bcw = ($supparrcode["maxw"] * $xres); // Barcode width = Should always be 31.35mm * $size

			$fbw = $bcw + $llm + $rlm; // Full barcode width incl. light margins
			$ow = $fbw + $paddingL + $paddingR; // Full overall width incl. user-defined padding
			$bch = $fbh - (1.5 * $size) - ($num_height + 0.5);  // Barcode height of bars	 (3mm for numerals)

			$xpos = $x + $paddingL + $llm;
			$ypos = $y + $paddingT + $num_height + 0.5;

			if ($col) {
				$this->SetFColor($col);
			} else {
				$this->SetFColor($this->colorConverter->convert(0, $this->PDFAXwarnings));
			}

			if ($supparrcode !== false) {
				foreach ($supparrcode["bcode"] as $v) {
					$bw = ($v["w"] * $xres);
					if ($v["t"]) {
						// draw a vertical bar
						$this->Rect($xpos, $ypos, $bw, $bch, 'F');
					}
					$xpos += $bw;
				}
			}

			// Characters
			if ($bgcol) {
				$this->SetFColor($bgcol);
			} else {
				$this->SetFColor($this->colorConverter->convert(255, $this->PDFAXwarnings));
			}

			$this->SetFontSize(3 * $fh * $size * Mpdf::SCALE); // 3mm numerals (FontSize is larger to account for space above/below characters)
			$this->x = $x + $paddingL + $llm;
			$this->y = $y + $paddingT;
			$this->Cell($bcw, $num_height, $supplement_code, 0, 0, 'C');

			// Outer Right character (light margin)
			$this->SetFontSize(($outerfontsize / 3) * 3 * $fh * $size * Mpdf::SCALE); // 3mm numerals (FontSize is larger to account for space above/below characters)
			$this->x = $x + $paddingL + $llm + $bcw + $rlm - ($cw * 0.9); // 0.9 is correction as char does not fill full width
			$this->y = $y + $paddingT;
			$this->Cell($cw * ($outerfontsize / 3), $num_height, '>', 0, 0, 'R');
		}

		// Restore **************
		$this->SetFont($prevFontFamily, $prevFontStyle, $prevFontSizePt);
		$this->DrawColor = $prevDrawColor;
		$this->TextColor = $prevTextColor;
		$this->FillColor = $prevFillColor;
		$this->SetLineWidth($lw);
		$this->SetY($y);
	}
730755
private function classDeclaration() {
    $node = new ClassNode();
    $this->matchDocComment($node);
    $this->tryMatch(T_ABSTRACT, $node, 'abstract') || $this->tryMatch(T_FINAL, $node, 'final');
    $this->mustMatch(T_CLASS, $node);
    $name_node = new NameNode();
    $this->mustMatch(T_STRING, $name_node, NULL, TRUE);
    $node->addChild($name_node, 'name');
    if ($this->tryMatch(T_EXTENDS, $node)) {
      $node->addChild($this->name(), 'extends');
    }
    if ($this->tryMatch(T_IMPLEMENTS, $node)) {
      $implements = new CommaListNode();
      do {
        $implements->addChild($this->name());
      } while ($this->tryMatch(',', $implements));
      $node->addChild($implements, 'implements');
    }
    $this->matchHidden($node);
    $statement_block = new StatementBlockNode();
    $this->mustMatch('{', $statement_block, NULL, FALSE, TRUE);
    $is_abstract = $node->getAbstract() !== NULL;
    while ($this->currentType !== NULL && $this->currentType !== '}') {
      $this->matchHidden($statement_block);
      $statement_block->addChild($this->classStatement($is_abstract));
    }
    $this->mustMatch('}', $statement_block, NULL, TRUE, TRUE);
    $node->addChild($statement_block, 'statements');
    return $node;
  }