数组转对象

@param $array
480255
public function fromArray($array) {
        if ($array instanceof Record) {
            $array = $array->toArray('', false);
        }
        foreach ($array as $key => $value) {
            if (isset($value)) {
                if($value instanceof Search){
                    $value=$value->value();
                }
                $this->$key = $value;
            }
        }
    }
572316
public static function IsSingleDepth( array $array ) : bool
   {

      if ( \count( $array ) < 1 )
      {
         return false;
      }

      foreach ( $array as $v )
      {
         if ( \is_array( $v ) && \count( $v ) > 0 )
         {
            return false;
         }
      }

      return true;

   }
45544
public function copyFromArray(array &$array)
    {
        // grantType
        $this->setGrantType(
            GrantType::valueOf(
                LanguageUtility::getFromArray('grantType', $array)));

        // clientId
        $this->setClientId(
            LanguageUtility::getFromArray('clientId', $array));

        // subject
        $this->setSubject(
            LanguageUtility::getFromArray('subject', $array));

        // scopes
        $this->setScopes(
            LanguageUtility::getFromArray('scopes', $array));

        // accessTokenDuration
        $this->setAccessTokenDuration(
            LanguageUtility::getFromArray('accessTokenDuration', $array));

        // refreshTokenDuration
        $this->setRefreshTokenDuration(
            LanguageUtility::getFromArray('refreshTokenDuration', $array));

        // properties
        $properties = LanguageUtility::getFromArray('properties', $array);
        $this->setProperties(
            LanguageUtility::convertArrayToArrayOfArrayCopyable(
                $properties, __NAMESPACE__ . '\Property'));

        // clientIdAliasUsed
        $this->setClientIdAliasUsed(
            LanguageUtility::getFromArrayAsBoolean('clientIdAliasUsed', $array));

        // accessToken
        $this->setAccessToken(
            LanguageUtility::getFromArray('accessToken', $array));

        // refreshToken
        $this->setRefreshToken(
            LanguageUtility::getFromArray('refreshToken', $array));
    }
234318
public function assign($array = [])
    {
        foreach ($array as $key => $value) {
            if (is_string($key)) {
                $this->set($key, $value);
            }
        }

        return $this;
    }
482006
private function combine($array) {
        $new_array = [];
        $i = $j = $key = 0;

        foreach ($array as $item) {

            $array_ip1 = (isset($array[$i+1])) ? $array[$i+1] : null;

            end($new_array);
            $cur = current($new_array);

            if ((strstr('+-', $item)) && (strstr('+-', $cur)) && (strstr('+-', $array_ip1))) {
                if ($item === '-')
                    $new_array[key($new_array)] = ($cur == '+') ? '-' : '+';
            } elseif ((strstr('+-', $item)) && (strstr('*/^', $cur)) && (strstr('+-', $array_ip1))) {
                $new_array[] = $item;
            } else {
                if ((strstr('+-', $item)) && ($key+1 != $i) && (strstr('*/^', $array[$key]))
                && (!is_numeric($array[$key+1])) && (isset($array[$key+1]))) {
                    if ($item === '-')
                        $new_array[key($new_array)] = ($cur == '+') ? '-' : '+';
                } else {
                    $new_array[] = $item;
                    $key = $i;
                }
            }
            $i++;
        }

        $array = $new_array;
        $new_array = [];

        foreach ($array as $item) {

            $array_i = $array[$j];
            $array_ip1 = (isset($array[$j+1])) ? $array[$j+1] : null;
            $array_im1 = (isset($array[$j-1])) ? $array[$j-1] : null;
            $array_im2 = (isset($array[$j-2])) ? $array[$j-2] : null;
            $array_im3 = (isset($array[$j-3])) ? $array[$j-3] : null;

            if ($item === '+' || $item === '-') {
                if (($j == 0 && is_numeric($array_ip1))
                || ($j > 0 && is_numeric($array_ip1)
                && stristr('+-*/^e', $array_im1))) {
                    if ($item === '+') {
                        $new_array[] = $array_ip1;
                    } else {
                        if ($array_im1 === '-' && $array_im2 !== '-') {
                            $new_array[] = $array_ip1;
                        } elseif ($array_im1 === '-' && $array_im3 === '-') {
                            $this->correct = 0;
                            break;
                        } else {
                            $new_array[] = $item.$array_ip1;
                        }
                    }
                } else {
                    if ($item === '-' && $array_ip1 === '-') {
                        if (count($new_array))
                            $new_array[] = '+';
                    } elseif ($item === '-' && $array_ip1 === '+') {
                        if (count($new_array))
                            $new_array[] = '+';
                        $new_array[] = '0';
                        $new_array[] = '-';
                    } else {
                        if (count($new_array) || $item != '+')
                            $new_array[] = $item;
                    }
                }
            } elseif (($j == 1 && is_numeric($item) && strstr('+-', $array_im1))
            || ($j > 1 && is_numeric($item) && strstr('+-', $array_im1)
            && (stristr('+-*/^e', $array_im2)))) {
            } else {
                $new_array[] = $item;
            }
            $j++;
        }
        return $new_array;
    }
1311737
public function copyFromArray(array &$array)
    {
        parent::copyFromArray($array);

        // action
        $this->setAction(
            TokenIssueAction::valueOf(
                LanguageUtility::getFromArray('action', $array)));

        // responseContent
        $this->setResponseContent(
            LanguageUtility::getFromArray('responseContent', $array));

        // accessToken
        $this->setAccessToken(
            LanguageUtility::getFromArray('accessToken', $array));

        // accessTokenExpiresAt
        $this->setAccessTokenExpiresAt(
            LanguageUtility::getFromArray('accessTokenExpiresAt', $array));

        // accessTokenDuration
        $this->setAccessTokenDuration(
            LanguageUtility::getFromArray('accessTokenDuration', $array));

        // refreshToken
        $this->setRefreshToken(
            LanguageUtility::getFromArray('refreshToken', $array));

        // refreshTokenExpiresAt
        $this->setRefreshTokenExpiresAt(
            LanguageUtility::getFromArray('refreshTokenExpiresAt', $array));

        // refreshTokenDuration
        $this->setRefreshTokenDuration(
            LanguageUtility::getFromArray('refreshTokenDuration', $array));

        // clientId
        $this->setClientId(
            LanguageUtility::getFromArray('clientId', $array));

        // clientIdAlias
        $this->setClientIdAlias(
            LanguageUtility::getFromArray('clientIdAlias', $array));

        // subject
        $this->setSubject(
            LanguageUtility::getFromArray('subject', $array));

        // scopes
        $this->setScopes(
            LanguageUtility::getFromArray('scopes', $array));

        // properties
        $properties = LanguageUtility::getFromArray('properties', $array);
        $this->setProperties(
            LanguageUtility::convertArrayToArrayOfArrayCopyable(
                $properties, __NAMESPACE__ . '\Property'));
    }
28059
public function copyToArray(array &$array)
    {
        parent::copyToArray($array);

        $array['action']                = LanguageUtility::toString($this->action);
        $array['responseContent']       = $this->responseContent;
        $array['username']              = $this->username;
        $array['password']              = $this->password;
        $array['ticket']                = $this->ticket;
        $array['accessToken']           = $this->accessToken;
        $array['accessTokenExpiresAt']  = LanguageUtility::orZero($this->accessTokenExpiresAt);
        $array['accessTokenDuration']   = LanguageUtility::orZero($this->accessTokenDuration);
        $array['refreshToken']          = $this->refreshToken;
        $array['refreshTokenExpiresAt'] = LanguageUtility::orZero($this->refreshTokenExpiresAt);
        $array['refreshTokenDuration']  = LanguageUtility::orZero($this->refreshTokenDuration);
        $array['idToken']               = $this->idToken;
        $array['grantType']             = LanguageUtility::toString($this->grantType);
        $array['clientId']              = $this->clientId;
        $array['clientIdAlias']         = $this->clientIdAlias;
        $array['clientIdAliasUsed']     = $this->clientIdAliasUsed;
        $array['subject']               = $this->subject;
        $array['scopes']                = $this->scopes;
        $array['properties']            = LanguageUtility::convertArrayOfArrayCopyableToArray($this->properties);
    }
567672
public static function set(array &$array, $key, $value)
    {
        $keys = explode('.', $key);
        foreach($keys as $key) {
            if(!isset($array[$key])) {
                $array[$key] = [];
            }
            $array = &$array[$key];
        }

        $array = $value;
    }
1243092
public static function isSequential(array $array)
    {
        $count = count($array);

        for ($i = 0; $i < $count; $i++) {
            if (!isset($array[$i]) && !array_key_exists($i, $array)) {
                return false;
            }
        }

        return true;
    }
1291186
public function copyFromArray(array &$array)
    {
        parent::copyFromArray($array);

        // serviceApiKey
        $this->setServiceApiKey(
            LanguageUtility::getFromArray('serviceApiKey', $array));

        // clientId
        $this->setClientId(
            LanguageUtility::getFromArray('clientId', $array));

        // subject
        $this->setSubject(
            LanguageUtility::getFromArray('subject', $array));

        // latestGrantedScopes
        $this->setLatestGrantedScopes(
            LanguageUtility::getFromArray('latestGrantedScopes', $array));

        // mergedGrantedScopes
        $this->setMergedGrantedScopes(
            LanguageUtility::getFromArray('mergedGrantedScopes', $array));

        // modifiedAt
        $this->setModifiedAt(
            LanguageUtility::getFromArray('modifiedAt', $array));
    }
43627
public static function count(array $array)
    {
        $count = 0;

        foreach ($array as $v) {
            if (is_array($v)) {
                $count += self::count($v);
            } else {
                $count++;
            }
        }
        
        return $count;
    }
1218632
public function copyFromArray(array &$array)
    {
        // parameters
        $this->setParameters(
            LanguageUtility::getFromArray('parameters', $array));

        // clientId
        $this->setClientId(
            LanguageUtility::getFromArray('clientId', $array));

        // clientSecret
        $this->setClientSecret(
            LanguageUtility::getFromArray('clientSecret', $array));

        // clientCertificate
        $this->setClientCertificate(
            LanguageUtility::getFromArray('clientCertificate', $array));

        // clientCertificatePath
        $this->setClientCertificatePath(
            LanguageUtility::getFromArray('clientCertificatePath', $array));

        // properties
        $properties = LanguageUtility::getFromArray('properties', $array);
        $this->setProperties(
            LanguageUtility::convertArrayToArrayOfArrayCopyable(
                $properties, __NAMESPACE__ . '\Property'));
    }
254380
public function setDefaultValues($array)
  {
    foreach ($this->fields as $field=>$el) {
      $v = false;
      if (is_array($array)) {
        $v = isset($array[$field]) ? $array[$field] : false;
      }
      $el->setDefaultValue($v);
    }
  }
822708
public function startArray($array) {
    $this->doPreVisit();
    foreach($array as $currentObject) {
      $currentObject->acceptVisitor($this);
    }
    $this->doPostVisit();
  }
1367712
private function validateArray(array $array): bool
  {
    foreach ($array as $element)
    {
      if (is_array($element))
      {
        $tmp = $this->validateArray($element);
        if ($tmp===true)
        {
          return true;
        }
      }
      else
      {
        if ($element!==null && $element!==false && $element!=='')
        {
          return true;
        }
      }
    }

    return false;
  }
1241702
private function cloneArray(array &$array): void
    {
        foreach ($array as $key => $value) {
            if (is_object($value)) {
                $array[$key] = clone $value;
            }
            if (is_array($value)) {
                $this->cloneArray($array[$key]);
            }
        }
    }
1054139
protected function normalize(array &$array)
    {
        foreach ($array as $key => $value) {
            if (array_key_exists($key, self::$apcFix)) {
                unset($array[$key]);
                $array[self::$apcFix[$key]] = $value;
            }
        }
    }