Parses a array to a {@see \Beluga\Drawing\Size} instance.

@param  array $objectData
@param  bool  $fixed      Is this instance fixed? (fixed is the read-only mode).
@return \Beluga\Drawing\Size
550984
public static function FromArray( array $objectData, bool $fixed = false ) : Size
   {

      $w = 0;
      if ( isset( $objectData[ 'width' ] ) )
      {
         $w = \intval( $objectData[ 'width' ] );
      }
      else if ( isset( $objectData[ 'Width' ] ) )
      {
         $w = \intval( $objectData[ 'Width' ] );
      }
      else if ( isset( $objectData[ 0 ] ) )
      {
         $w = \intval( $objectData[ 0 ] );
      }

      $h = 0;
      if ( isset( $objectData[ 'height' ] ) )
      {
         $h = \intval( $objectData[ 'height' ] );
      }
      else if ( isset( $objectData[ 'Height' ] ) )
      {
         $h = \intval( $objectData[ 'Height' ] );
      }
      else if ( isset( $objectData[ 1 ] ) )
      {
         $h = \intval( $objectData[ 1 ] );
      }

      if ( isset( $objectData[ 'fixed' ] ) )
      {
         $fixed = (bool) \intval( $objectData[ 'fixed' ] );
      }

      return new Size( $w, $h, $fixed );

   }
695398
public static function filterData($objectData, $filters = array())
    {
        $result = array();
        $listFilters = array();

        //====================================================================//
        // Process All Single Fields Ids & Store Sorted List Fields Ids
        foreach ($filters as $fieldId) {
            //====================================================================//
            // Explode List Field Id
            $isList = self::isListField($fieldId);
            //====================================================================//
            // Single Field Data Type
            if ((!$isList) && (array_key_exists($fieldId, $objectData))) {
                $result[$fieldId] = $objectData[$fieldId];
            } elseif (!$isList) {
                continue;
            }
            //====================================================================//
            // List Field Data Type
            $listName = $isList['listname'];
            $fieldName = $isList['fieldname'];
            //====================================================================//
            // Check List Data are Present in Block
            if (!array_key_exists($listName, $objectData)) {
                continue;
            }
            //====================================================================//
            // Create List
            if (!array_key_exists($listName, $listFilters)) {
                $listFilters[$listName] = array();
            }
            $listFilters[$listName][] = $fieldName;
        }

        //====================================================================//
        // Process All List Fields Ids Filters
        foreach ($listFilters as $listName => $listFilters) {
            $result[$listName] = self::filterListData($objectData[$listName], $listFilters);
        }

        return $result;
    }
547289
private function parsePagination(\SimpleXMLElement $xmldata)
    {
        $pagination = new Pagination();
        $paginated = false;

        foreach ($xmldata->children('opensearch', true) as $key => $value) {
            switch ($key) {
                case 'totalResults':
                    $pagination->setNumberOfItem((int) $value);
                    $paginated = true;
                    break;
                case 'itemsPerPage':
                    $pagination->setItemsPerPage((int) $value);
                    $paginated = true;
                    break;
            }
        }

        return $paginated ? $pagination : null;
    }
1267201
public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        $states = array();
        foreach ($data['ObjectState'] as $rawStateData) {
            $states[] = $parsingDispatcher->parse(
                $rawStateData,
                $rawStateData['_media-type']
            );
        }

        return $states;
    }
245670
private function parseFeedData($encryptedData, $decryptedData)
    {
        $orders = new \SimpleXMLElement($decryptedData);

        // loop over each transaction to find FoxyCart Order ID
        foreach ($orders->transactions->transaction as $transaction) {
            $this->processTransaction($transaction, $encryptedData);
        }
    }
113417
private function readByteStringShort($subData)
    {
        // offset: 0; size: 1; length of the string (character count)
        $ln = ord($subData[0]);

        // offset: 1: size: var; character array (8-bit characters)
        $value = $this->decodeCodepage(substr($subData, 1, $ln));

        return array(
            'value' => $value,
            'size' => 1 + $ln, // size in bytes of data structure
        );
    }
764656
public function getTypeFromObjectData(ObjectDataInterface $objectData)
    {
        if ($objectData->getProperties() === null || count($objectData->getProperties()->getProperties()) === 0) {
            return null;
        }

        $typeProperty = $objectData->getProperties()->getProperties()[PropertyIds::OBJECT_TYPE_ID];

        if (!$typeProperty instanceof PropertyId) {
            return null;
        }

        return $this->session->getTypeDefinition($typeProperty->getFirstValue());
    }
1143044
public function setDataObject($data)
    {
        if (true === is_object($data)) {
            $data = json_encode($data);
        }

        return $this->setData($data);
    }
596172
public static function tokenize(string $plainData) : array
    {
        $tokens = [];

        if(! empty($plainData)) {
            $tokens = (new self($plainData))->tokenizeInternal()->tokens;
        }

        return $tokens;
    }
704513
protected function normalizeData($rawData)
    {
        $data = array();
        foreach ($rawData as $key => $value) {
            if (is_array($value)) {
                $item = array('text' => $key, 'children' => $this->normalizeData($rawData[$key]));
            } else {
                $item = array('id' => $key, 'text' => $value);
            }
            $data[] = $item;
        }
        return $data;
    }
134384
protected function setParsedData($parsedData): Payload
    {
        $data = json_decode($parsedData);
        if (JSON_ERROR_NONE === json_last_error()) {
            $this->parsedData = $data;
        }

        return $this;
    }
102345
private function decodeMultiple(&$apiData)
    {
        $resObj = json_decode($apiData);

        if (isset($resObj->status)) {
            $msg = "Error " . $resObj->status . " " . $resObj->message;
            throw new \Exception($msg);
        } else {
            //$itemsArray = $resObj->items;
            if (!is_array($resObj)) {
                return false;
            } else {
                return $resObj;
            }
        }
    }
1239055
private static function readUnicodeStringLong($subData)
    {
        $value = '';

        // offset: 0: size: 2; length of the string (character count)
        $characterCount = self::getInt2d($subData, 0);

        $string = self::readUnicodeString(substr($subData, 2), $characterCount);

        // add 2 for the string length
        $string['size'] += 2;

        return $string;
    }
1353483
public function registerData(array $entityData)
    {
        foreach ($entityData as $data) {
            $this->registerEntity($this->normalizer->denormalize(
                $data,
                $this->entityCollection->getEntityClass()
            ));
        }
    }
251678
public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        $groups = array();
        foreach ($data['ObjectStateGroup'] as $rawGroupData) {
            $groups[] = $parsingDispatcher->parse(
                $rawGroupData,
                $rawGroupData['_media-type']
            );
        }

        return $groups;
    }
724778
public function createObjectStateListFromData(array $data)
    {
        $objectStates = array();

        foreach ($data as $objectStateData) {
            $objectStates[] = $this->createObjectStateFromData($objectStateData);
        }

        return $objectStates;
    }
1146200
public static function decodeToObj(string $stringData): \stdClass
    {
        $decoded = json_decode($stringData, false);

        if ($decoded === null) {
            $errNo = json_last_error();
            $msg = json_last_error_msg();
            throw new Exception("Unable to decode JSON string, error ({$errNo}): {$msg}", $errNo);
        }

        return $decoded;
    }