Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with laravel #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 37 additions & 16 deletions src/nusoap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3552,6 +3552,20 @@ function getCookiesForRequest($cookies, $secure = false)
*/
class nusoap_server extends nusoap_base
{
/**
* Indicate the framework that is used
*
* @var string
* @access public
*/
var $framework = "";
/**
* Routes of the classes in the framework
*
* @var string
* @access public
*/
var $route_class = "";
/**
* HTTP headers of request
*
Expand Down Expand Up @@ -4105,23 +4119,30 @@ function invoke_method()

$class = '';
$method = '';
if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1) {
$try_class = substr($this->methodname, 0, strpos($this->methodname, $delim));
if (class_exists($try_class)) {
// get the class and method name
$class = $try_class;
$method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
$this->debug("in invoke_method, class=$class method=$method delim=$delim");
if ($this->framework === ""){
if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1) {
$try_class = substr($this->methodname, 0, strpos($this->methodname, $delim));
if (class_exists($try_class)) {
// get the class and method name
$class = $try_class;
$method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
$this->debug("in invoke_method, class=$class method=$method delim=$delim");
} else {
$this->debug("in invoke_method, class=$try_class not found");
}
} elseif (strlen($delim) > 0 && substr_count($this->methodname, $delim) > 1) {
$split = explode($delim, $this->methodname);
$method = array_pop($split);
$class = implode('\\', $split);
} else {
$this->debug("in invoke_method, class=$try_class not found");
}
} elseif (strlen($delim) > 0 && substr_count($this->methodname, $delim) > 1) {
$split = explode($delim, $this->methodname);
$method = array_pop($split);
$class = implode('\\', $split);
} else {
$try_class = '';
$this->debug("in invoke_method, no class to try");
$try_class = '';
$this->debug("in invoke_method, no class to try");
}
} else if ($this->framework === "laravel"){
$try_class = substr($this->methodname, 0, strpos($this->methodname, $delim));
$new_route_class = $this->route_class."\\".$try_class;
$class = new $new_route_class;
$method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
}

// does method exist?
Expand Down