private function do()

in util/ActionTest.php [97:133]


    private function do(array $actions): string
    {
        $vars = [
            ':endpoint'       => '',
            ':params'         => '',
            ':catch'          => '',
            ':response-check' => ''
        ];
        foreach ($actions as $key => $value) {
            if (method_exists($this, $key)) {
                $this->$key($value, $vars);
            } else {
                // headers
                if (!empty($this->headers)) {
                    if ($value instanceof stdClass && empty(get_object_vars($value))) {
                        $value = [];
                    }
                    $value['client'] = [
                        'headers' => $this->formatHeaders($this->headers)
                    ];
                    $this->headers = [];
                }
                // Check if {} (new stdClass) is the parameter of an endpoint
                if ($value instanceof stdClass && empty(get_object_vars($value))) {
                    $params = '';
                } else {
                    $params = $this->adjustClientParams($value);
                    $params = var_export($params, true);
                    $params = $this->convertDollarValueInVariable($params); // replace '$var' or '${var}' in $var
                    $params = $this->convertStdClass($params); // convert "stdClass::__set_state(array())" in "(object)[]"
                }
                $vars[':endpoint'] = $this->convertDotToArrow($key);
                $vars[':params']   = str_replace("\n", "\n" . self::TAB14, $params);
            }
        }
        return YamlTests::render(self::TEMPLATE_ENDPOINT, $vars);
    }