Package be.selckin.ws.util.java2php.php

Examples of be.selckin.ws.util.java2php.php.Argument


        php.appendLine("");
        php.appendField("client", "null");
        php.appendLine("");

        php.startFunction("__construct", Arrays.asList(new Argument("url"), new Argument("extraConfig")));
        php.appendLine("$this->client = new \\SoapClient($url, array_merge(array(");
        php.appendLine("'style' => SOAP_DOCUMENT,");
        php.appendLine("'features' => SOAP_SINGLE_ELEMENT_ARRAYS,");
        php.appendLine("'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,");
        php.appendLine("'exceptions' => TRUE,");
View Full Code Here


            List<PhpProperty> required = phpClass.getRequiredProperties();
            if (!required.isEmpty()) {
                List<Argument> args = new ArrayList<>();
                for (PhpProperty property : required) {
                    args.add(new Argument(property.getTypeHint(), property.getName()));
                }

                code.appendPhpDocVars(required);
                code.startFunction("__construct", args);
                {
                    for (PhpProperty property : required) {
                        code.appendLine("$this->" + property.getSetterName() + "($" + property.getName() + ");");
                    }
                }

                code.endFunction();
            }

            code.appendLine("");
            for (PhpProperty phpProperty : phpClass.getProperties()) {
                code.appendPhpDocReturn(phpProperty.getTypeHint());
                code.startFunction(phpProperty.getGetterName(), Collections.<Argument>emptyList());
                code.appendLine("return $this->" + phpProperty.getName() + ";");
                code.endFunction();

                code.appendPhpDocParam("value", phpProperty);
                if (phpProperty.getExplicitNamespace() == null) {
                    code.startFunction(phpProperty.getSetterName(), Arrays.asList(new Argument(phpProperty.getTypeHint(), "value")));
                    code.appendLine("$this->" + phpProperty.getName() + " = $value;");
                    code.endFunction();
                } else {
                    code.startFunction(phpProperty.getSetterName(), Arrays.asList(new Argument(phpProperty.getTypeHint(), "value")));
                    code.appendLine("$this->" + phpProperty.getName() + " = array_map(function($item) {");
                    code.appendLine("    if ($item instanceof \\SoapVar) {");
                    code.appendLine("        return $item;");
                    code.appendLine("    } else {");
                    code.appendLine("        return new \\SoapVar($item, SOAP_ENC_OBJECT, \"" + phpProperty.getName() + "\", \"" + phpProperty.getExplicitNamespace() + "\", null, \"" + phpProperty.getExplicitNamespace() + "\");");
View Full Code Here

                typeHint = new TypeHint(itemInfo.isArray(), nameManager.getAbsolutePhpClassName(baseName));
            } else {
                typeHint = new TypeHint(itemInfo.isArray());
            }

            arguments.add(new Argument(typeHint, itemInfo.getXmlName()));
        }

        TypeHint returnType = findReturnType(currentOperation);

        current.addOperation(new Operation(nameManager.getPhpName(currentOperation.getName()), returnType, arguments));
View Full Code Here

TOP

Related Classes of be.selckin.ws.util.java2php.php.Argument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.