src/POData/BaseService.php
/**
     * For the given entry object compare it's eTag (if it has eTag properties)
     * with current eTag request headers (if it present).
     * 
     * @param mixed        &$entryObject             entity resource for which etag 
     *                                               needs to be checked.
     * @param ResourceType &$resourceType            Resource type of the entry 
     *                                               object.
     * @param boolean      &$needToSerializeResponse On return, this will contain 
     *                                               True if response needs to be
     *                                               serialized, False otherwise.
     *                                              
     * @return string|null The ETag for the entry object if it has eTag properties 
     *                     NULL otherwise.
     */
For the given entry object compare it's eTag (if it has eTag properties)
with current eTag request headers (if it present).

@param mixed        &$entryObject             entity resource for which etag
needs to be checked.
@param ResourceType &$resourceType            Resource type of the entry
object.
@param boolean      &$needToSerializeResponse On return, this will contain
True if response needs to be
serialized, False otherwise.

@return string|null The ETag for the entry object if it has eTag properties
NULL otherwise.
For the given entry object compare it ' s eTag ( if it has eTag properties ) with current eTag request headers ( if it present ) . @param mixed &$entryObject entity resource for which etag needs to be checked . @param ResourceType &$resourceType Resource type of the entry object . @param boolean &$needToSerializeResponse On return this will contain True if response needs to be serialized False otherwise . @return string|null The ETag for the entry object if it has eTag properties NULL otherwise .
protected function compareETag(&$entryObject, ResourceType &$resourceType, 
        &$needToSerializeResponse
    ) {      
        $needToSerializeResponse = true;
        $eTag = null;
        $ifMatch = $this->_serviceHost->getRequestIfMatch();
        $ifNoneMatch = $this->_serviceHost->getRequestIfNoneMatch();
        if (is_null($entryObject)) {
            if (!is_null($ifMatch)) {
                throw ODataException::createPreConditionFailedError(
                    Messages::eTagNotAllowedForNonExistingResource()
                ); 
            }
            return null;
        }
        if ($this->config->getValidateETagHeader() && !$resourceType->hasETagProperties()) {
            if (!is_null($ifMatch) || !is_null($ifNoneMatch)) {
				throw ODataException::createBadRequestError(
                    Messages::noETagPropertiesForType()
                );
            }
            return null;
        }
        if (!$this->config->getValidateETagHeader()) {
            return null;
        }
        if (is_null($ifMatch) && is_null($ifNoneMatch)) {
        } else if (strcmp($ifMatch, '*') == 0) {
        } else if (strcmp($ifNoneMatch, '*') == 0) {
            $needToSerializeResponse = false;
        } else {
            $eTag = $this->getETagForEntry($entryObject, $resourceType);
            $eTag = ODataConstants::HTTP_WEAK_ETAG_PREFIX . $eTag . '"';
            if (!is_null($ifMatch)) {
                if (strcmp($eTag, $ifMatch) != 0) {
                    throw ODataException::createPreConditionFailedError(
                        Messages::eTagValueDoesNotMatch()
                    );
                }
            } else if (strcmp($eTag, $ifNoneMatch) == 0) {
                $needToSerializeResponse = false;
            }
        }
        if (is_null($eTag)) {
            $eTag = $this->getETagForEntry($entryObject, $resourceType);
            $eTag = ODataConstants::HTTP_WEAK_ETAG_PREFIX . $eTag . '"';
        }
        return $eTag;
    }
protected function compareETag ( & $ entryObject , ResourceType & $ resourceType , & $ needToSerializeResponse ) { $ needToSerializeResponse = true ; $ eTag = null ; $ ifMatch = $ this -> _serviceHost -> getRequestIfMatch ( ) ; $ ifNoneMatch = $ this -> _serviceHost -> getRequestIfNoneMatch ( ) ; if ( is_null ( $ entryObject ) ) { if ( ! is_null ( $ ifMatch ) ) { throw ODataException :: createPreConditionFailedError ( Messages :: eTagNotAllowedForNonExistingResource ( ) ) ; } return null ; } if ( $ this -> config -> getValidateETagHeader ( ) && ! $ resourceType -> hasETagProperties ( ) ) { if ( ! is_null ( $ ifMatch ) || ! is_null ( $ ifNoneMatch ) ) { throw ODataException :: createBadRequestError ( Messages :: noETagPropertiesForType ( ) ) ; } return null ; } if ( ! $ this -> config -> getValidateETagHeader ( ) ) { return null ; } if ( is_null ( $ ifMatch ) && is_null ( $ ifNoneMatch ) ) { } else if ( strcmp ( $ ifMatch , '*' ) == 0 ) { } else if ( strcmp ( $ ifNoneMatch , '*' ) == 0 ) { $ needToSerializeResponse = false ; } else { $ eTag = $ this -> getETagForEntry ( $ entryObject , $ resourceType ) ; $ eTag = ODataConstants :: HTTP_WEAK_ETAG_PREFIX . $ eTag . '"' ; if ( ! is_null ( $ ifMatch ) ) { if ( strcmp ( $ eTag , $ ifMatch ) != 0 ) { throw ODataException :: createPreConditionFailedError ( Messages :: eTagValueDoesNotMatch ( ) ) ; } } else if ( strcmp ( $ eTag , $ ifNoneMatch ) == 0 ) { $ needToSerializeResponse = false ; } } if ( is_null ( $ eTag ) ) { $ eTag = $ this -> getETagForEntry ( $ entryObject , $ resourceType ) ; $ eTag = ODataConstants :: HTTP_WEAK_ETAG_PREFIX . $ eTag . '"' ; } return $ eTag ; }
For the given entry object compare it's eTag (if it has eTag properties)
 with current eTag request headers (if it present).
For the given entry object compare it ' s eTag ( if it has eTag properties ) with current eTag request headers ( if it present ) .
// No eTag properties but request has eTag headers, bad request // We need write the response but no eTag header  // Configuration says do not validate ETag so we will not write ETag header in the  // response even though the requested resource support it // No request eTag header, we need to write the response  // and eTag header  // If-Match:* => we need to write the response and eTag header  // if-None-Match:* => Do not write the response (304 not modified),  // but write eTag header // Note: The following code for attaching the prefix W\" // and the suffix " can be done in getETagForEntry function // but that is causing an issue in Linux env where the  // firefix browser is unable to parse the ETag in this case. // Need to follow up PHP core devs for this.  // Requested If-Match value does not match with current  // eTag Value then pre-condition error // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html //304 not modified, but in write eTag header // Note: The following code for attaching the prefix W\" // and the suffix " can be done in getETagForEntry function // but that is causing an issue in Linux env where the  // firefix browser is unable to parse the ETag in this case. // Need to follow up PHP core devs for this. 