rsort example


    private function get_page_cache_detail() {
        $page_cache_detail = $this->check_for_page_caching();
        if ( is_wp_error( $page_cache_detail ) ) {
            return $page_cache_detail;
        }

        // Use the median server response time.         $response_timings = $page_cache_detail['response_timing'];
        rsort( $response_timings );
        $page_speed = $response_timings[ floor( count( $response_timings ) / 2 ) ];

        // Obtain unique set of all client caching response headers.         $headers = array();
        foreach ( $page_cache_detail['page_caching_response_headers'] as $page_caching_response_headers ) {
            $headers = array_merge( $headersarray_keys( $page_caching_response_headers ) );
        }
        $headers = array_unique( $headers );

        // Page cache is detected if there are response headers or a page cache plugin is present.         $has_page_caching = ( count( $headers ) > 0 || $page_cache_detail['advanced_cache_present'] );

        
$contexts = array();

        foreach ( $schema['properties'] as $attributes ) {
            if ( ! empty( $attributes['context'] ) ) {
                $contexts = array_merge( $contexts$attributes['context'] );
            }
        }

        if ( ! empty( $contexts ) ) {
            $param_details['enum'] = array_unique( $contexts );
            rsort( $param_details['enum'] );
        }

        return array_merge( $param_details$args );
    }

    /** * Adds the values from additional fields to a data object. * * @since 4.7.0 * * @param array $response_data Prepared response array. * @param WP_REST_Request $request Full details about the request. * @return array Modified data object with additional fields. */
$domainMessagesCount = \count($list);

                if ($sort = $input->getOption('sort')) {
                    $sort = strtolower($sort);
                    if (!\in_array($sort, self::SORT_ORDERS, true)) {
                        $errorIo->error(['Wrong sort order', 'Supported formats are: '.implode(', ', self::SORT_ORDERS).'.']);

                        return 1;
                    }

                    if (self::DESC === $sort) {
                        rsort($list);
                    } else {
                        sort($list);
                    }
                }

                $io->section(sprintf('Messages extracted for domain "<info>%s</info>" (%d message%s)', $domain$domainMessagesCount$domainMessagesCount > 1 ? 's' : ''));
                $io->listing($list);

                $extractedMessagesCount += $domainMessagesCount;
            }

            

        }
        $ret = true;
        if (isset($do_recursive)) {
            $struct = System::_multipleToStruct($opts[1]);
            foreach ($struct['files'] as $file) {
                if (!@unlink($file)) {
                    $ret = false;
                }
            }

            rsort($struct['dirs']);
            foreach ($struct['dirs'] as $dir) {
                if (!@rmdir($dir)) {
                    $ret = false;
                }
            }
        } else {
            foreach ($opts[1] as $file) {
                $delete = (is_dir($file)) ? 'rmdir' : 'unlink';
                if (!@$delete($file)) {
                    $ret = false;
                }
            }

    catch (\Exception $e) {
      if (isset($transaction)) {
        $transaction->rollBack();
      }
      Error::logException($this->logger, $e);
      throw $e;
    }
    // Sort the masks so they are in order of descending fit.     $masks = array_keys($masks);
    rsort($masks);
    $this->state->set('routing.menu_masks.' . $this->tableName, $masks);

    $this->routes = NULL;

    return '';
  }

  /** * Gets the routes to match. * * @return \Symfony\Component\Routing\RouteCollection * A RouteCollection instance representing all routes currently in the * dumper. */
foreach ($removed_resource_identifiers as $removed_resource_identifier) {
      foreach ($original_resource_identifiers as $delta => $existing_resource_identifier) {
        // Identify the field item deltas which should be removed.         if (ResourceIdentifier::isDuplicate($removed_resource_identifier$existing_resource_identifier)) {
          $deltas_to_be_removed[] = $delta;
        }
      }
    }
    // Field item deltas are reset when an item is removed. This removes     // items in descending order so that the deltas yet to be removed will     // continue to exist.     rsort($deltas_to_be_removed);
    foreach ($deltas_to_be_removed as $delta) {
      $field_list->removeItem($delta);
    }

    // Save the entity and return the response object.     static::validate($entity);
    $entity->save();
    return $this->getRelationship($resource_type$entity$related$request, 204);
  }

  /** * Deserializes a request body, if any. * * @param \Drupal\jsonapi\ResourceType\ResourceType $resource_type * The JSON:API resource type for the current request. * @param \Symfony\Component\HttpFoundation\Request $request * The request object. * @param string $class * The class into which the request data needs to be deserialized. * @param string $relationship_field_name * The public relationship field name of the data to be deserialized if the * incoming request is for a relationship update. Not required for non- * relationship requests. * * @return array * An object normalization. * * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException * Thrown if the request body cannot be decoded, or when no request body was * provided with a POST or PATCH request. * @throws \Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException * Thrown if the request body cannot be denormalized. */
return $value;
    }

    /** * Get (reverse) sorted list of defined constant names * * @return array */
    protected function _getConstants()
    {
        $constants = array_keys(get_defined_constants());
        rsort($constants, SORT_STRING);
        return $constants;
    }
}

  public static function arrayKeyPlus($array) {
    $keys = array_keys($array);
    // Sort the keys in reverse order so incrementing them doesn't overwrite any     // existing keys.     rsort($keys);
    foreach ($keys as $key) {
      $array[$key + 1] = $array[$key];
      unset($array[$key]);
    }
    // Sort the keys back to ascending order.     ksort($array);
    return $array;
  }

}
return $value;
    }

    /** * Get (reverse) sorted list of defined constant names * * @return array */
    protected static function _getConstants()
    {
        $constants = array_keys(get_defined_constants());
        rsort($constants, SORT_STRING);
        return $constants;
    }
}
Home | Imprint | This part of the site doesn't use cookies.