Perforce Chronicle 2012.2/486814
API Documentation

Workflow_ConditionAbstract Class Reference

Base class for workflow conditions. More...

Inheritance diagram for Workflow_ConditionAbstract:
Workflow_PluginAbstract Workflow_ConditionInterface Workflow_Workflow_Condition_Contains Workflow_Workflow_Condition_False

List of all members.

Public Member Functions

 evaluate (Workflow_Model_Transition $transition, P4Cms_Record $record, array $pending=null)
 Determine if this condition is satisified for the given transition and record.
 isNegated ()
 Detrmine if condition is negated, i.e.

Public Attributes

const OPTION_NEGATE = 'negate'

Protected Member Functions

 _evaluate (Workflow_Model_Transition $transition, P4Cms_Record $record, array $pending=null)
 This is the real workhorse to evaluate if condition is satisfied for the given transition in context with given record.

Detailed Description

Base class for workflow conditions.

Workflow conditions control which workflow transitions are valid for a given record.

This abstract class provides basic handling of options (curtesy of the plugin abstract class) and the ability to negate a condition (via the 'negate' option). Sub-classes must implement _evaluate().

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

Workflow_ConditionAbstract::_evaluate ( Workflow_Model_Transition transition,
P4Cms_Record record,
array $  pending = null 
) [abstract, protected]

This is the real workhorse to evaluate if condition is satisfied for the given transition in context with given record.

Must be implemented by sub-class.

See Workflow_ConditionInterface for further commentary.

Parameters:
Workflow_Model_Transition$transitiontransition to evaluate this condition for.
P4Cms_Record$recordrecord to evaluate this condition for.
array | null$pendingoptional - updated values to consider.
Returns:
boolean true if this condition is satisfied for transition and record, flase otherwise.

Reimplemented in Workflow_Workflow_Condition_Contains, and Workflow_Workflow_Condition_False.

Workflow_ConditionAbstract::evaluate ( Workflow_Model_Transition transition,
P4Cms_Record record,
array $  pending = null 
)

Determine if this condition is satisified for the given transition and record.

Proxies to the _evaluate() method (must be implemented by sub-class) to perform actual work of evaluating the condition. This provides built-in support for a negate option (i.e. returns inverted value if condition is negated).

See Workflow_ConditionInterface for further commentary.

Parameters:
Workflow_Model_Transition$transitiontransition to evaluate this condition for.
P4Cms_Record$recordrecord to evaluate this condition for.
array | null$pendingoptional - updated values to consider.
Returns:
boolean true if this condition is satisfied for transition and record, flase otherwise.

Implements Workflow_ConditionInterface.

    {
        $isConditionMet = $this->_evaluate($transition, $record, $pending);
        return $this->isNegated() ? !$isConditionMet : $isConditionMet;
    }
Workflow_ConditionAbstract::isNegated ( )

Detrmine if condition is negated, i.e.

if 'negate' option is present and set to true.

Returns:
boolean true if condition is negated, false otherwise.
    {
        return isset($this->_options[static::OPTION_NEGATE]) 
            && $this->_options[static::OPTION_NEGATE];
    }

Member Data Documentation


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