You are here

final public static function ResourceFieldBase::isArrayNumeric in RESTful 7.2

Helper method to determine if an array is numeric.

Parameters

array $input: The input array.

Return value

boolean TRUE if the array is numeric, false otherwise.

Overrides ResourceFieldInterface::isArrayNumeric

11 calls to ResourceFieldBase::isArrayNumeric()
Articles__1_5::imageProcess in modules/restful_example/src/Plugin/resource/node/article/v1/Articles__1_5.php
Process callback, Remove Drupal specific items from the image array.
Formatter::limitFields in src/Plugin/formatter/Formatter.php
Returns only the allowed fields by filtering out the other ones.
FormatterJsonApi::parseBody in src/Plugin/formatter/FormatterJsonApi.php
Parses the body string into the common format.
FormatterJsonApi::renormalize in src/Plugin/formatter/FormatterJsonApi.php
Move the embedded resources to the included key.
FormatterJsonApi::restructureItem in src/Plugin/formatter/FormatterJsonApi.php
Take a JSON API item and makes it hierarchical object, like simple JSON.

... See full list

File

src/Plugin/resource/Field/ResourceFieldBase.php, line 299
Contains \Drupal\restful\Plugin\resource\Field\ResourceFieldBase.

Class

ResourceFieldBase

Namespace

Drupal\restful\Plugin\resource\Field

Code

public static final function isArrayNumeric(array $input) {
  $keys = array_keys($input);
  foreach ($keys as $key) {
    if (!ctype_digit((string) $key)) {
      return FALSE;
    }
  }
  return isset($keys[0]) ? $keys[0] == 0 : TRUE;
}