Transforms an ACEType result into an ACE

@param object $data
@return ace
495707
public function reverseTransform($data)
    {
        $sidParts = explode(':', $data['sid']);
        if(strtoupper($sidParts[0]) == 'R') {
            /* is rolebased */
            $sid = new RoleSecurityIdentity($sidParts[1]);
        } else {
            if(3 == count($sidParts)) {
                /* has 3 sidParts */
                $class = $sidParts[2];
            } else {
                if($this->isLdapUser($sidParts[1])) {
                    /* is LDAP user*/
                    $class = 'Mapbender\LdapIntegrationBundle\Entity\LdapUser';
                } else {
                    /* is not a LDAP user*/
                    $class = 'FOM\UserBundle\Entity\User';
                }
            }
            $sid = new UserSecurityIdentity($sidParts[1], $class);
        }

        $maskBuilder = new MaskBuilder();
        foreach($data['permissions'] as $bit => $permission) {
            if(true === $permission) {
                $maskBuilder->add(1 << ($bit - 1));
            }
        }

        return array(
            'sid' => $sid,
            'mask' => $maskBuilder->get());
    }
1353764
protected function convertObject($data)
    {

        if ($this->isIgnoredObject($data)) {
            return;
        }

        if ($this->isXMLElement($data)) {
            return $data;
        }

        $reflection = new ReflectionObject($data);

        if ($this->isArrayAble($reflection)) {
            $data = $data->toArray();
            return $this->ensureBuildable($data);
        }

        if ($this->isCircularReference($data)) {
            return;
        }

        $out = [];

        $methods    = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
        $properties = $reflection->getProperties(ReflectionProperty::IS_PUBLIC);

        $this->getObjectGetterValues($methods, $data, $out);

        $this->setObjectProperties($properties, $data, $out);

        return $out;
    }
952880
public function sanitizeForSerialization($data)
    {
        if (is_scalar($data) || null === $data) {
            $sanitized = $data;
        } else if ($data instanceof \DateTime) {
            $sanitized = $data->format(\DateTime::ISO8601);
        } else if (is_array($data)) {
            foreach ($data as $property => $value) {
                $data[$property] = $this->sanitizeForSerialization($value);
            }
            $sanitized = $data;
        } else if (is_object($data)) {
            $values = array();
            foreach (array_keys($data::$swaggerTypes) as $property) {
                $getter = $data::$getters[$property];
                if ($data->$getter() !== null) {
                    $values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$getter());
                }
            }
            ksort($values);
            $sanitized = $values;
        } else {
            $sanitized = (string)$data;
        }

        return $sanitized;
    }
667748
public function make( array $data = null )
    {
        $obj = parent::make( $data );
        $this->instancesUnpersisted[] = $obj;
        return $obj;
    }
1239098
protected function transform($data)
    {
        if (!$data instanceof GetSchema\Schema) {
            throw new Exception('Data is not a Schema.');
        }

        $definition = $data->getTableDefinition($this->table);
        $defSchema = $definition->getSchema();

        $returnData = [];
        $row = [
            self::KEY_TABLE => $definition->getName(),
            0 => $definition->getName(),
            self::KEY_CREATE_TABLE => $defSchema,
            1 => $defSchema,
        ];
        $returnData[] = $row;

        return $returnData;
    }
1197961
public static function fromDER(string $data): RSAPublicKey
    {
        return self::fromASN1(UnspecifiedType::fromDER($data)->asSequence());
    }
650750
static public function toObject($data)
    {
        if (is_object($data)) {
            return $data;
        }
        if (is_array($data)) {
            $data = json_encode($data);
        }
        return json_decode($json);
    }
1283792
protected function asArray($data)
	{
		$array = array();

		if (is_object($data))
		{
			$data = get_object_vars($data);
		}

		foreach ($data as $k => $v)
		{
			if (is_object($v) || is_array($v))
			{
				$array[$k] = $this->asArray($v);
			}
			else
			{
				$array[$k] = $v;
			}
		}

		return $array;
	}
471541
protected function createObjectFrom($data)
    {
        $class_name = $this->class_name;

        try {
            return new $class_name($data);
        } catch (\InvalidArgumentException $e) {
            throw new ConverterException(
                sprintf("Unable to create a '%s' instance.", $class_name),
                null,
                $e
            );
        }
    }
583146
private function normalizeFloat($data) {
		if (is_infinite($data)) {
			$postfix = 'INF';
			if ($data < 0) {
				$postfix = '-' . $postfix;
			}
			$data = $postfix;
		} else {
			if (is_nan($data)) {
				$data = 'NaN';
			}
		}

		return $data;
	}
528809
protected function convertEncoding($data)
    {
        if ($this->getEncodingInput() == $this->getEncodingOutput()) {
            return $data;
        }

        if (is_null($data)) {
            return $data;
        }

        if (is_array($data)) {
            foreach ($data as $key => $value) {
                $data[$key] = $this->convertEncoding($value);
            }

            return $data;
        }

        if ($this->getEncodingOutput() == 'UTF-8') {
            return utf8_encode($data);
        }

        return utf8_decode($data);
    }
330315
public function convert( $data ) {
		if ( is_object($data) ) {
			$data = Helper::convert_wp_object($data);
		} else if ( is_array($data) ) {
			$func = __FUNCTION__;
			foreach ( $data as &$ele ) {
				if ( is_array($ele) ) {
					$ele = $this->$func($ele);
				} else if ( is_object($ele) ) {
					$ele = Helper::convert_wp_object($ele);
				}
			}
		}
		return $data;
	}
1030045
protected function transform($data)
    {

        $items = [
            'name'       => $data[ 'name' ],
            'static'     => $this->boolValue($data[ '@attributes.static' ]),
            'line'       => (int)$data[ '@attributes.line' ],
            'visibility' => $data[ '@attributes.visibility' ],
            'namespace'  => $data[ '@attributes.namespace' ],
            'package'    => $data[ '@attributes.package' ],

            'description'      => $this->createDescription($data[ 'docblock.description' ]),
            'long-description' => $this->createDescription($data[ 'docblock.long-description' ]),
        ];

        $items[ 'full_name' ]  = $data->get('full_name', $this->belongsTo[ 'full_name' ] . '::' . Str::removeLeft($data[ 'name' ], '$'));
        $items[ 'class_name' ] = head(explode('::', $items[ 'full_name' ]));
        $items[ 'inherited' ]  = $this->belongsTo[ 'full_name' ] !== $items[ 'class_name' ];
        $items[ 'tags' ]       = $this->structures('docblock.tag', Tag::class, $data);

        $types = $data->get('docblock.tag.type', 'mixed');
        if ( !is_array($types) ) {
            $types = [ $types ];
        }
        $items[ 'types' ] = $types;

        return $items;
    }
841714
public function fromArray($data)
    {
        foreach ($data as $key => $val) {
            if (is_int($key)) {
                if (method_exists($this, "add")) {
                    $this->add($val);
                }
            }

            $propertyName = $key;
            $ourPropertyName = array_search($propertyName, $this->propNameMap);

            if ($ourPropertyName && isset($data[$ourPropertyName])) {
                $propertyName = $ourPropertyName;
            }

            if (!empty($this->propNameMap)) {
                if (array_key_exists($key, $this->propNameMap)) {
                    $propertyName = $this->propNameMap[$key];
                }
            }

            if (property_exists($this, $propertyName)) {
                if (isset($this->mappingClasses[$propertyName])) {
                    $this->{$propertyName} = new $this->mappingClasses[$propertyName]($val);
                } else {
                    $this->{$propertyName} = $val;
                }
            }
        }
        return $this;
    }
917928
public static function encode($data)
    {
        switch (gettype($data)) {
            case 'array':
                return self::encodeArray($data);
            case 'object':
                return self::encodeObject($data);
            case 'string':
                return self::encodeString($data);
            case 'integer':
                return self::encodeInteger($data);
            case 'boolean':
                return self::encodeBoolean($data);
            case 'double':
                return self::encodeDouble($data);
            case 'NULL':
                return self::encodeNull($data);
            case 'resource':
                // TODO
                break;
            default:
                throw new UnencodeableException('Contains unencodeable type', 3);
        }
    }
795634
public function createOne($data)
    {
        // Event
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'data' => &$data,
            ]
        );

        $dataset = $this->create($this->bindDataset([$data]));

        $result = $dataset[0];

        // Event
        $this->triggerEvent(
            'onAfter' . ucfirst(__FUNCTION__),
            [
                'result' => &$result,
            ]
        );

        return $result;
    }
1182029
protected function convertValue($data)
    {
        if ($this->isTraversable($data)) {
            return $this->recursiveConvertArray($data);
        }

        if (is_object($data)) {
            return $this->convertObject($data) ?: null;
        }

        return $data;
    }