Perforce Chronicle 2012.2/486814
API Documentation

P4Cms_Diff_Options Class Reference

Wrapper for diff comparison options. More...

List of all members.

Public Member Functions

 getOption ($name)
 Get a named diff option.
 getSplitArgs ()
 Get the split pattern to use when comparing strings.
 isBinaryDiff ()
 Check if this is a binary diff (no string splitting).
 isSkipped ()
 Check if this diff is to be skipped.
 setBinaryDiff ($binary)
 Perform binary diff (no string splitting).
 setOption ($name, $value)
 Set a named diff option.
 setSkipped ($skip)
 Skip this diff.
 setSplitArgs ($pattern, $flags)
 Set the preg split pattern and flags to use when comparing strings.

Public Attributes

const BINARY_DIFF = 'binaryDiff'
const PATTERN_CHARS = '//u'
const PATTERN_LINES = '/\r\n|\n|\r/'
const SKIP_DIFF = 'skipDiff'
const SPLIT_ARGS = 'splitArgs'

Detailed Description

Wrapper for diff comparison options.

Accepts arbitrary name/value options to allow options to influence later consumption of differences.

Copyright:
2011-2012 Perforce Software. All rights reserved
License:
Please see LICENSE.txt in top-level folder of this distribution.
Version:
2012.2/486814

Member Function Documentation

P4Cms_Diff_Options::getOption ( name)

Get a named diff option.

Parameters:
string$namethe name of the option to get.
Returns:
mixed the value of the named option - null if no such option.
    {
        return $this->offsetExists($name) ? $this->offsetGet($name) : null;
    }
P4Cms_Diff_Options::getSplitArgs ( )

Get the split pattern to use when comparing strings.

Returns:
array the pattern and flags to use with preg_split.
    {
        return $this->getOption(static::SPLIT_ARGS);
    }
P4Cms_Diff_Options::isBinaryDiff ( )

Check if this is a binary diff (no string splitting).

Returns:
bool true if this diff should be done as binary.
    {
        return (bool) $this->getOption(static::BINARY_DIFF);
    }
P4Cms_Diff_Options::isSkipped ( )

Check if this diff is to be skipped.

Returns:
bool true if this diff should be skipped.
    {
        return (bool) $this->getOption(static::SKIP_DIFF);
    }
P4Cms_Diff_Options::setBinaryDiff ( binary)

Perform binary diff (no string splitting).

Parameters:
bool$binarytrue to do binary diff.
    {
        $this->setOption(static::BINARY_DIFF, $binary);
    }
P4Cms_Diff_Options::setOption ( name,
value 
)

Set a named diff option.

Parameters:
string$namethe name of the option to set.
mixed$valuethe option value to set.
Returns:
P4Cms_Diff_Options provides fluent interface.
    {
        $this->offsetSet($name, $value);

        return $this;
    }
P4Cms_Diff_Options::setSkipped ( skip)

Skip this diff.

Useful when comparing models with multiple fields.

Parameters:
bool$skiptrue to skip diff.
    {
        $this->setOption(static::SKIP_DIFF, $skip);
    }
P4Cms_Diff_Options::setSplitArgs ( pattern,
flags 
)

Set the preg split pattern and flags to use when comparing strings.

Parameters:
string$patterna preg_split compatible pattern.
int | null$flagsoptional - flags to pass to preg_split
    {
        $this->setOption(
            static::SPLIT_ARGS,
            array($pattern, $flags)
        );
    }

Member Data Documentation

const P4Cms_Diff_Options::BINARY_DIFF = 'binaryDiff'
const P4Cms_Diff_Options::PATTERN_LINES = '/\r\n|\n|\r/'
const P4Cms_Diff_Options::SKIP_DIFF = 'skipDiff'
const P4Cms_Diff_Options::SPLIT_ARGS = 'splitArgs'

The documentation for this class was generated from the following file: