public function isModified($selector = null)
    {
        if (empty($this->modifiedFields)) {
            return false;
        }

        if (empty($selector)) {
            return (bool) $this->modifiedFields;
        }

        foreach ($this->modifiedFields as $modifiedField) {
            if (preg_match('/^' . $selector . '($|.)/', $modifiedField)) {
                return true;
            }
        }

        return false;
    }
public function isModified($selector = null)
    {
        if (empty($this->modifiedFields)) {
            return false;
        }

        if (empty($selector)) {
            return (bool) $this->modifiedFields;
        }

        foreach ($this->modifiedFields as $modifiedField) {
            if (preg_match('/^' . $selector . '($|.)/', $modifiedField)) {
                return true;
            }
        }

        return false;
    }
public function isModified ( $ selector = null ) { if ( empty ( $ this -> modifiedFields ) ) { return false ; } if ( empty ( $ selector ) ) { return ( bool ) $ this -> modifiedFields ; } foreach ( $ this -> modifiedFields as $ modifiedField ) { if ( preg_match ( '/^' . $ selector . '($|.)/' , $ modifiedField ) ) { return true ; } } return false ; }
If selector passed, return true if field is modified.
If selector omitted, return true if document is modified.

@param string|null $selector
@return bool
If selector passed return true if field is modified . If selector omitted return true if document is modified .