@param object|array $data

@return mixed|null
514790
public function getValue($data)
    {
        if (is_object($data)) {
            return $this->getReflection()->getValue($data);
        }

        if (isset($data[$this->attributeName])) {
            return $data[$this->attributeName];
        }

        return null;
    }
1017963
public static function fromArray(array $data)
	{
		return new self(
			!empty($data['code'])    ? $data['code']    : null,
			!empty($data['message']) ? $data['message'] : null,
			!empty($data['data'])    ? $data['data']    : null
		);
	}
907667
public function json($data)
    {
        if (isset($data['url']) && ! empty($data['url'])) {
            $result = @file_get_contents($data['url']);
            $result = json_decode($result, true);
        }
        return isset($result) ? $result : null;
    }
456328
public function data($data = []) {
        if (count($data) == 0) {
            return $this->_data;
        }
        else {
            $this->_data = $data;
        }

        return null;
    }
1159660
private function convertToJson($data)
    {
        if (is_array($data)) {
            return json_encode($data);
        }

        if ($data instanceof Jsonable) {
            return $data->toJson();
        }

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

        return null;
    }
558983
protected final function getWhere($data) {
        $con = [];
        foreach ($this->primaryKeys as $f) {
            if (array_key_exists($f, $data)) {
                if (isset($data[ $f ])) {
                    $con [ $f ] = $data [ $f ];
                } else {
                    $con [ $f . ' $' ] = null;
                }
            }
        }

        return $con;
    }
631876
public function execute($data = null)
    {
        if ($this->getEndMiddleware()) {
            $end = $this->getEndMiddleware();

            if (count($this->stack)) {
                $this->stack->bottom()->setNext($end);
            }

            $this->stack->unshift($end);
        }

        if (!count($this->stack)) {
            return null;
        }

        // Start call chaining.
        $result = $this->stack->top()->execute($data);

        // Remove end middleware so we can re-use this chain.
        if ($this->getEndMiddleware()) {
            $this->stack->shift();
        }

        return $result;
    }
1156193
public function convertObjectParents(array $data = null)
    {
        return array_filter(
            array_map(
                [$this, 'convertObjectParentData'],
                (array) ($data ?? [])
            ),
            function ($item) {
                return !empty($item);
                // @TODO once a logger is available we should log an INFO message if the parent data could not be converted
            }
        );
    }
1096097
private static function getObjectFromArray($data): self
    {
        if (!isset($data['last_access'])) {
            $lastAccess = null;
        } else {
            $lastAccess = new \DateTime($data['last_access']);
        }

        return new self(
            $data['user_id'],
            $data['organization_id'],
            $data['roles'],
            $data['active'],
            $lastAccess
        );
    }
344728
protected function retrieveData($data)
    {
        $filter = $this->getInputFilter();

        if (null !== $filter) {
            return $filter->getValues();
        }

        return (array)$data;
    }
148639
public function initByData( array $data = null )
    {

        if( !$data ) {
            return null;
        }

        // table inheritance - ghetto?
        /*
        if( isset( $data['tableoid'] ) ) {
            if( $data['tableoid'] != static::OID ) {
                $repo = Repository::init( $data['tableoid'] );
                return $repo->initByData( $data );
            }
            unset( $data['tableoid'] );
        }
        */

        $key = call_user_func(
            array( $this->entityClass, 'keyGet' ),
            $data
        );

        // is this already in the cache? Are we initalising something we've already loaded?
        if( isset( $this->instancesPersisted[$key] ) ) {

            // Late loading? Don't need this anymore.
            $obj = $this->instancesPersisted[$key];
            $obj->__construct( $data );
            return $obj;

        }

        $obj = parent::initByData($data);
        $this->instancesPersisted[$key] = $obj;

        return $obj;

    }
893218
public function convertObjectInFolderList(array $data = null)
    {
        if (empty($data)) {
            return null;
        }
        $objects = array_filter(
            array_map(
                [$this, 'convertObjectInFolder'],
                $data[JSONConstants::JSON_OBJECTINFOLDERLIST_OBJECTS] ?? []
            ),
            function ($item) { return !empty($item); }
        );
        $objectInFolderList = new ObjectInFolderList();
        $objectInFolderList->setObjects($objects);
        $objectInFolderList->setHasMoreItems((boolean) ($data[JSONConstants::JSON_OBJECTINFOLDERLIST_HAS_MORE_ITEMS] ?? false));
        $objectInFolderList->setNumItems((integer)($data[JSONConstants::JSON_OBJECTINFOLDERLIST_NUM_ITEMS] ?? count($objects)));
        $objectInFolderList->setExtensions($this->convertExtension($data, JSONConstants::getObjectInFolderListKeys()));

        return $objectInFolderList;
    }
390364
public static function arrayToObject($data)
    {
        if (is_array($data)) {
            /*
            * Return array converted to object
            * Using __FUNCTION__ (Magic constant)
            * for recursive call
            */
            $self_name = 'self::' . __FUNCTION__;

            return (object)array_map($self_name, $data);
        } else {
            // Return object
            return $data;
        }
    }
710032
public function convertObjectParentData(array $data = null)
    {
        if (empty($data)) {
            return null;
        }
        $parent = new ObjectParentData();

        $object = $this->convertObject($data[JSONConstants::JSON_OBJECTPARENTS_OBJECT] ?? null);
        if ($object !== null) {
            $parent->setObject($object);
        }

        $parent->setRelativePathSegment((string) ($data[JSONConstants::JSON_OBJECTPARENTS_RELATIVE_PATH_SEGMENT] ?? ''));
        $parent->setExtensions($this->convertExtension($data, JSONConstants::getObjectParentsKeys()));

        return $parent;
    }
149411
public function findToolFrom($data)
    {
        $tools = $this->getAvailableTools();
        foreach ($tools as $tool) {
            if (in_array($data, $tool, true)) {
                return $tool;
            }
        }
        return null;
    }
265117
protected function getId(array $data)
    {
        $result = null;

        if (isset($data['id'])) {
            $result = $data['id'];
        } elseif (isset($data['name'])) {
            $result = $data['name'];
        } else {
            #$result = sha1($data['action'] . $data['method']);
            $result = sha1(serialize($data));
        }

        return $result;
    }
908201
public function convertObjectList(array $data = null)
    {
        if (empty($data)) {
            return null;
        }

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

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

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

        $objectList->setObjects($objects);

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

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

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

        return $objectList;
    }