Webiny\Component\StdLib\StdObject\UrlObject\UrlObject::val PHP Method

val() public method

Return, or update, current standard objects value.
public val ( null | string $url = null ) : mixed
$url null | string
return mixed
    public function val($url = null)
    {
        if ($this->isNull($url)) {
            return $this->value;
        }
        $this->value = $url;
        $this->validateUrl();
        return $this;
    }

Usage Example

Example #1
0
 /**
  * Redirect the request to the given url.
  *
  * @param string|UrlObject $url
  * @param string|int|array $headers Headers that you wish to send with your request.
  * @param int              $redirectCode
  */
 protected static function httpRedirect($url, $headers = [], $redirectCode = 301)
 {
     $url = new UrlObject($url);
     $headers['Location'] = $url->val();
     $response = new Response('', $redirectCode, $headers);
     $response->sendHeaders();
 }
All Usage Examples Of Webiny\Component\StdLib\StdObject\UrlObject\UrlObject::val