Webiny\Component\StdLib\StdObject\StdObjectWrapper::isStringObject PHP Method

isStringObject() public static method

Check if $var is an instance of StringObject.
public static isStringObject ( mixed $var ) : boolean
$var mixed Element to check.
return boolean
    public static function isStringObject($var)
    {
        if (self::isInstanceOf($var, 'Webiny\\Component\\StdLib\\StdObject\\StringObject\\StringObject')) {
            return true;
        }
        return false;
    }

Usage Example

Example #1
0
 /**
  * Set url query param.
  *
  * @param StringObject|ArrayObject|string|array $query  Query params.
  * @param bool                                  $append Do you want to append or overwrite current query param.
  *                                                      In case when you are appending values, the values from $query,
  *                                                      that already exist in the current query, will be overwritten
  *                                                      by the ones inside the $query.
  *
  * @throws UrlObjectException
  * @return $this
  */
 public function setQuery($query, $append = false)
 {
     if ($this->isStdObject($query)) {
         $query = $query->val();
     }
     if ($append && $this->query != '') {
         if ($this->isString($this->query)) {
             $currentQuery = new StringObject($this->query);
             $currentQuery = $currentQuery->parseString();
         } else {
             $currentQuery = new ArrayObject($this->query);
         }
         if ($this->isStdObject($query)) {
             if (StdObjectWrapper::isArrayObject($append)) {
                 $query = $query->val();
             } else {
                 if (StdObjectWrapper::isStringObject($query)) {
                     $query = $query->parseString()->val();
                 } else {
                     throw new UrlObjectException(UrlObjectException::MSG_INVALID_ARG, ['$query', 'StringObject|ArrayObject|string|array']);
                 }
             }
         } else {
             if ($this->isString($query)) {
                 $query = new StringObject($query);
                 $query = $query->parseString()->val();
             }
         }
         $currentQuery->merge($query);
         $query = $currentQuery->val();
     }
     $this->query = $query;
     $this->rebuildUrl();
     return $this;
 }
All Usage Examples Of Webiny\Component\StdLib\StdObject\StdObjectWrapper::isStringObject