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
Beispiel #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;
 }
Beispiel #2
0
 /**
  * Check if $instance is a StringObject.
  *
  * @param mixed $instance
  *
  * @return bool
  */
 protected static function isStringObject($instance)
 {
     return StdObjectWrapper::isStringObject($instance);
 }