/** * Short description of method createOperation * * @access public * @author firstname and lastname of author, <*****@*****.**> * @param Term term1 * @param Term term2 * @param Resource operator * @return core_kernel_rules_Operation */ public static function createOperation(core_kernel_rules_Term $term1, core_kernel_rules_Term $term2, core_kernel_classes_Resource $operator) { $returnValue = null; $operationClass = new core_kernel_classes_Class(CLASS_OPERATION, __METHOD__); $label = 'Def Operation Label ' . $term1->getLabel() . ' ' . $operator->getLabel() . ' ' . $term2->getLabel(); $comment = 'Def Operation Comment ' . $term1->getUri() . ' ' . $operator->getUri() . ' ' . $term2->getUri(); $operatorProperty = new core_kernel_classes_Property(PROPERTY_OPERATION_OPERATOR, __METHOD__); $firstOperand = new core_kernel_classes_Property(PROPERTY_OPERATION_FIRST_OP, __METHOD__); $secondOperand = new core_kernel_classes_Property(PROPERTY_OPERATION_SECND_OP, __METHOD__); $termOperationInstance = core_kernel_classes_ResourceFactory::create($operationClass, $label, $comment); $returnValue = new core_kernel_rules_Operation($termOperationInstance->getUri()); $returnValue->debug = __METHOD__; $returnValue->setPropertyValue($operatorProperty, $operator->getUri()); $returnValue->setPropertyValue($firstOperand, $term1->getUri()); $returnValue->setPropertyValue($secondOperand, $term2->getUri()); return $returnValue; }
/** * Short description of method evaluateArtihmOperation * * @access public * @author firstname and lastname of author, <*****@*****.**> * @param array $variable * @return mixed */ public function evaluateArithmOperation($variable = array()) { $operation = new core_kernel_rules_Operation($this->getUri(), __METHOD__); return $operation->evaluate($variable); }