@param mixed                        $data
@param \Yosmanyga\Resource\Resource $resource

@return mixed
335518
public function normalize($data, Resource $resource)
    {
        $validator = new ExceptionValidator(new ArrayValidator([
            'requiredKeys'  => ['name'],
            'optionalKeys'  => ['property'],
            'allowExtra'    => false,
        ]));

        $validator->validate($data['value']);

        $definitions = [];
        if (isset($data['value']['property'])) {
            $definitions['properties'] = $this->normalizeProperties(
                $data['value']['property'],
                $resource
            );
        }

        return $this->createDefinition($data['value']['name'], $definitions);
    }
659617
private function createRequest($method, $resource, array $data = [])
    {
        if (!empty($data)) {
            $data['signature'] = $this->apiSignature;
        }

        return $this->requestFactory->createRequest($method, $resource, [], $this->encode($data));
    }
227802
protected function partial($resource, array $data = [])
	{
		if($resource instanceof ViewModelInterface)
		{
			return $this->view->render($resource, true);
		}
	
		return $this->view->render(new ViewModel($this->view->resolveResourcePath($resource), $data), true);
	}
139247
private function checkForUselessNodes(SimpleXMLElement $resource, $data)
    {
        $uselessNodes = [];
        foreach ($resource as $key => $value) {
            if (!array_key_exists($key, $data)) {
                $uselessNodes[] = $key;
            }
        }
        foreach ($uselessNodes as $key) {
            unset($resource->$key);
        }
    }
893755
public static function toJson($resource) {
		if (self::isJson($resource)) {
			return $resource;
		}

		if ($xml = self::isXml($resource)) {
			$resource = self::xmlToArray($xml);

		} else if ($ser = self::isSerialized($resource)) {
			$resource = $ser;
		}

		return json_encode($resource);
	}
432741
public function collection($resourceKey, array $data, $includeAttributes = true)
    {
        $resources = [];

        foreach ($data as $resource) {

            /**
             * Add option to override resource key with data.
             */
            if (is_array($resource) && array_key_exists('_resource_key', $resource)) {
                $resourceKey = $resource['_resource_key'];
                unset($resource['_resource_key']);
            }

            $resources[] = $this->item($resourceKey, $resource, $includeAttributes)['data'];
        }

        return ['data' => $resources];
    }
1255713
public function create($resource, $resouce_id, $data)
    {
        return $this->client->post("$resource/$resouce_id/comments", [$this->wrapper => $data])->response();
    }
1038717
public function serialize(Resource $resource)
    {
        return [
            'id' => $resource->getUuid(),
            'name' => $resource->getName(),
            'resourceType' => $this->resourceTypeSerializer->serialize($resource->getResourceType()),
            'maxTimeReservation' => $resource->getMaxTimeReservation(),
            'description' => $resource->getDescription(),
            'localization' => $resource->getLocalisation(),
            'quantity' => $resource->getQuantity(),
            'color' => $resource->getColor(),
            'organizations' => $this->getOrganizations($resource),
            'resourceRights' => $this->getResourceRights($resource),
        ];
    }
130862
private function execute(stdClass $data = null, $resourceId = null)
    {
        $body = empty($data) ? new stdClass() : $data;
        $response = $this->httpRequest($this->getPath($resourceId), Requests::POST, $body);

        return $this->populate($response);
    }
1269947
protected function convertResourceToObject($resource, $resourceId = null)
    {
        return ! $resource instanceof Resource ? new SimpleResource($resource, $resourceId) : $resource;
    }
601094
public function apply($resource){
		// Extract arguments
		@list(,$matrix,$offset)=func_get_args();
		$matrix=(array)$matrix;
		$offset=(int)$offset;
		// Verify matrix
		if(count($matrix)!=9){
			throw new Exception("The array parameter is a 3x3 matrix and must so contain 9 rows");
		}
		// Normalization
		$matrix=array(
			array($matrix[0],$matrix[1],$matrix[2]),
			array($matrix[3],$matrix[4],$matrix[5]),
			array($matrix[6],$matrix[7],$matrix[8])
		);
		// Compute normalization divisor
		$div=array_sum($matrix[0])+array_sum($matrix[1])+array_sum($matrix[2]);
		// Apply effect
		if(!imageconvolution($resource,$matrix,$div,$offset)){
			throw new Exception("Image convolution failed");
		}
		return $resource;
	}
311052
public function load($resource)
    {
        if ($issue = $this->getIssue($resource)) {
            return $this->createFeature($issue);
        }

        return $this->createFeatures();
    }
1001404
private function initializeRepository(ResourceManager $resourceManager, string $resource, Parameters $parameters)
    {
        $repository = $resourceManager->resolveRepository($resource);

        $repository->applyCondition(new LimitCondition($this->getLimit($parameters)));
        $offset = $parameters->getOffset();
        if (!empty($offset)) {
            $repository->applyCondition(new OffsetCondition($offset));
        }

        $sortCriterias = $repository->sortCriterias();
        $sort = $parameters->getSort(array_keys($sortCriterias));
        if (count($sort)) {
            foreach ($sort as $field => $direction) {
                $repository->applyCondition(new SortByCondition($sortCriterias[$field], $direction === 'desc'));
            }
        } else {
            foreach ($repository->defaultSortCriterias() as $field => $direction) {
                $repository->applyCondition(new SortByCondition($field, $direction === 'desc'));
            }
        }

        return $repository;
    }
91548
protected function checkRoleResource($role, $resource)
    {
        $resource = $this->checkResource($resource);
        $role = $this->checkRole($role);
        $roleId = ($role->getRoleId() == null) ? StorageInterface::ALL_ROLES : $role->getRoleId();
        $resrcId = ($resource->getResourceId() == null) ? StorageInterface::ALL_RESOURCES : $resource->getResourceId();
        if (!isset($this->permission[$roleId][self::NODE_RESOURCES][$resrcId][self::NODE_PERMISSION])) {
            $this->permission[$roleId][self::NODE_RESOURCES][$resrcId][self::NODE_PERMISSION] = [];
        }

        return $this;
    }
344832
public function removeResource(Resource $resource)
    {
        if (!isset($this->resources[$resource->getUri()])) {
            return;
        }
        unset($this->resources[$resource->getUri()]);
    }
937657
public function getResource($resource)
    {
        if ($this->resourceExists($resource)) return $this->_resources[$resource];

        throw new ContainerResourceNotFoundException('Resource ' . $resource . ' does not exist in the Container');
    }
812409
public function includedData(ResourceInterface $resource, array $data)
    {
        list($serializedData, $linkedIds) = $this->pullOutNestedIncludedData($data);

        foreach ($data as $value) {
            foreach ($value as $includeObject) {
                if ($this->isNull($includeObject) || $this->isEmpty($includeObject)) {
                    continue;
                }

                $includeObjects = $this->createIncludeObjects($includeObject);
                list($serializedData, $linkedIds) = $this->serializeIncludedObjectsWithCacheKey($includeObjects, $linkedIds, $serializedData);
            }
        }

        return empty($serializedData) ? [] : ['included' => $serializedData];
    }