Returns various, filtered, scalar elements

We're returning an array here to detect failure because null is a scalar and so is false

@param $data

@return mixed
556609
private function normalizeScalar($data) {
		if (null === $data || is_scalar($data)) {
			/*// utf8_encode only works for Latin1 so we rely on mbstring
			if (is_string($data)) {
				$data = mb_convert_encoding($data, "UTF-8");
			}*/

			if (is_float($data)) {
				$data = $this->normalizeFloat($data);
			}

			return $data;
		}

		return [];
	}
465690
public function get($data) {
        $is_one = !static::isSomeArr($data);;
        if ($is_one) {
            $data = [$data];
        }
        $data = $this->getWithMulti($data);
        return $is_one ? reset($data) : $data;
    }
751902
private static function filterData($data) {
        foreach($data as $key => $value) {
            if ( is_numeric($value) ) {
                $data[$key] = intval($value);
            }
        }
        return $data;
    }
1036201
private function cleanData(array $data) : array
  {
    foreach($data as $key => $value) {
      $data[$key] = $this->replace($key, $value);
    }

    return $data;
  }
904168
function filter($data = array())
    {
        if (! is_array($data)) {
            return $data;
        }
        // first apply the filters to the ROOT
        if (isset($this->filters[self::SELECTOR_ROOT])) {
            /* @var $rootFilters FilterSet */
            $rootFilters = $this->filters[self::SELECTOR_ROOT];
            $data = $rootFilters->applyFilters($data);
        }
        foreach ($data as $key => $value) {
            $data[$key] = $this->filterItem($data, $key);
        }
        return $data;
    }
560395
protected function asArray($data)
  {
    $array = [];
    
    foreach(get_object_vars((object)$data) as $k => $v){
      if ( is_object($v) ){
        $array[$k] = $this->asArray($v);
      }
      else {
        $array[$k] = $v;
      }
    }
    
    return $array;
  }
759975
public function convertTypeChildren(array $data = null)
    {
        if (empty($data)) {
            return null;
        }

        $result = new TypeDefinitionList();
        $types = [];

        $typesList = $data[JSONConstants::JSON_TYPESLIST_TYPES] ?? [];

        foreach (array_filter($typesList, 'is_array') as $typeData) {
            $type = $this->convertTypeDefinition($typeData);
            if ($type !== null) {
                $types[] = $type;
            }
        }

        $result->setList($types);
        $result->setHasMoreItems((boolean) ($data[JSONConstants::JSON_TYPESLIST_HAS_MORE_ITEMS] ?? false));
        $result->setNumItems($data[JSONConstants::JSON_TYPESLIST_NUM_ITEMS] ?? 0);
        $result->setExtensions($this->convertExtension($data, JSONConstants::getTypesListKeys()));

        return $result;
    }
1266371
protected static function normalize($data)
    {
        foreach ($data as $id => $value) {
            $data[$id] = strtoupper(NoDiacritic::filter($value));
        }
        return $data;
    }
744865
public function find(array $data)
    {
        if (empty($data)) {
            return [];
        }
        
        $pks = [];
        foreach ($data as $item) {
            if (is_scalar($item)) {
                $pks[] = $item;
                continue;
            }
            
            if (is_object($item)) {
                $item = (array)$item;
            }
            if (is_array($item)) {
                foreach ($this->possiblePks as $possiblePk) {
                    if (array_key_exists($possiblePk, $item)) {
                        $pks[] = $item[$possiblePk];
                        break;
                    }
                }
            }
        }
        
        return $pks;
    }
243352
private function parseSingleRelationship($data)
    {
        if ($data === null) {
            $result = null;
        } elseif (is_array($data) === true &&
            array_key_exists(DI::KEYWORD_TYPE, $data) === true &&
            array_key_exists(DI::KEYWORD_ID, $data) === true &&
            is_scalar($type = $data[DI::KEYWORD_TYPE]) === true &&
            is_scalar($index = $data[DI::KEYWORD_ID]) === true
        ) {
            $result = [$type => $index];
        } else {
            $result = false;
        }

        return $result;
    }
395297
public function get_sql_filter($data) {
        $field  = $this->field;
        if (is_array($field)) {
            $res = " {$field[0]} = {$field[1]} ";
        } else {
            $res = " {$field} = 0 ";
        }
        return array($res, array());
    }
54841
private function hydrateIfJsonToArray($data)
    {
        if (is_array($data)) {
            return $data;
        }
        elseif (is_string($data)) {
            $attempt = json_decode($data, true);
            return empty($attempt) ? $data : $attempt;
        }

        return [];
    }
565041
public function getTransformedData($data): array
    {
        if (method_exists($this, 'transform')) {
            // Transformer provides a 'transform' method
            return (array) $this->transform($data);
        }

        // Otherwise, use the withProps method which calls getProps()
        return $this->withProps($data, $this->getProps());
    }
872221
protected function _getData(array $data): array
    {
        // Stringify empty values
        if (!empty($data)) {
            foreach ($data as $fieldName => $value) {
                $data[$fieldName] = $this->_stringifyEmptyValue($value);
            }
        }

        return $data;
    }
457970
public function convertQueryResultList(array $data = null)
    {
        if (empty($data)) {
            return null;
        }

        $objectList = new ObjectList();
        $objects = [];

        foreach ((array) ($data[JSONConstants::JSON_QUERYRESULTLIST_RESULTS] ?? []) as $objectData) {
            $object = $this->convertObject($objectData);

            if ($object !== null) {
                $objects[] = $object;
            }
        }

        $objectList->setObjects($objects);
        $objectList->setHasMoreItems((boolean) ($data[JSONConstants::JSON_QUERYRESULTLIST_HAS_MORE_ITEMS] ?? false));

        if (isset($data[JSONConstants::JSON_QUERYRESULTLIST_NUM_ITEMS])) {
            $objectList->setNumItems((integer) $data[JSONConstants::JSON_QUERYRESULTLIST_NUM_ITEMS]);
        }

        $objectList->setExtensions($this->convertExtension($data, JSONConstants::getQueryResultListKeys()));

        return $objectList;
    }
969600
public function transform($data)
    {
        if (is_array($data)) {
            return $data;
        }

        if (is_object($data) && $data instanceof Arrayable) {
            return $data->toArray();
        }

        return (array) $data;
    }
216752
public static function keys($data = false) {

        if ($data && Validate::isArray($data)) {

            return array_keys($data);
        } else if ($data && Validate::isObject($data)) {

            return get_object_vars($data);
        }

        return false;
    }