public function getScenarioParameter($key, $checkExp = false) {
        $parameters = $this->getScenarioParameters();
        // var_dump(array_keys($parameters));
        $user = null;
        if ($this->currentUser) {
            $user = $this->find($this->userClass, $this->currentUser->getId());
        }
        $value = null;
        if (empty($key)) {
            xdebug_print_function_stack();
            throw new Exception("The scenario parameter can not be empty.");
        }
        if (isset($parameters[$key])) {
            if (is_callable($parameters[$key])) {
                $value = call_user_func_array($parameters[$key], [$user, $this]);
            } else {
                $value = $parameters[$key];
            }
        } else {
            $found = false;
            if ($checkExp === true) {
                foreach ($parameters as $k => $v) {
                    if (preg_match("/" . $k . "/", $key)) {
                        $value = str_replace($k, $this->getScenarioParameter($k), $key);
                        $found = true;
                        break;
                    }
                }
            }
            if (!$found) {
                throw new Exception(sprintf("The scenario parameter '%s' is not defined", $key));
            }
        }
        return $value;
    }
public function getScenarioParameter($key, $checkExp = false) {
        $parameters = $this->getScenarioParameters();
        // var_dump(array_keys($parameters));
        $user = null;
        if ($this->currentUser) {
            $user = $this->find($this->userClass, $this->currentUser->getId());
        }
        $value = null;
        if (empty($key)) {
            xdebug_print_function_stack();
            throw new Exception("The scenario parameter can not be empty.");
        }
        if (isset($parameters[$key])) {
            if (is_callable($parameters[$key])) {
                $value = call_user_func_array($parameters[$key], [$user, $this]);
            } else {
                $value = $parameters[$key];
            }
        } else {
            $found = false;
            if ($checkExp === true) {
                foreach ($parameters as $k => $v) {
                    if (preg_match("/" . $k . "/", $key)) {
                        $value = str_replace($k, $this->getScenarioParameter($k), $key);
                        $found = true;
                        break;
                    }
                }
            }
            if (!$found) {
                throw new Exception(sprintf("The scenario parameter '%s' is not defined", $key));
            }
        }
        return $value;
    }
public function getScenarioParameter ( $ key , $ checkExp = false ) { $ parameters = $ this -> getScenarioParameters ( ) ; // var_dump(array_keys($parameters)); $ user = null ; if ( $ this -> currentUser ) { $ user = $ this -> find ( $ this -> userClass , $ this -> currentUser -> getId ( ) ) ; } $ value = null ; if ( empty ( $ key ) ) { xdebug_print_function_stack ( ) ; throw new Exception ( "The scenario parameter can not be empty." ) ; } if ( isset ( $ parameters [ $ key ] ) ) { if ( is_callable ( $ parameters [ $ key ] ) ) { $ value = call_user_func_array ( $ parameters [ $ key ] , [ $ user , $ this ] ) ; } else { $ value = $ parameters [ $ key ] ; } } else { $ found = false ; if ( $ checkExp === true ) { foreach ( $ parameters as $ k => $ v ) { if ( preg_match ( "/" . $ k . "/" , $ key ) ) { $ value = str_replace ( $ k , $ this -> getScenarioParameter ( $ k ) , $ key ) ; $ found = true ; break ; } } } if ( ! $ found ) { throw new Exception ( sprintf ( "The scenario parameter '%s' is not defined" , $ key ) ) ; } } return $ value ; }
Obtiene el valor de un parametro en el escenario
@param type $key
@return type
@throws Exception
Obtiene el valor de un parametro en el escenario