From: James Pepin Date: Sun, 27 Sep 2009 01:29:14 +0000 (-0400) Subject: return $this from add* methods to allow method chaining X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2826b6560c8557f232fd871fb9caa97862b86ed0;p=horde.git return $this from add* methods to allow method chaining --- diff --git a/framework/Log/lib/Horde/Log/Filter/Constraint.php b/framework/Log/lib/Horde/Log/Filter/Constraint.php index 06fb66f6b..7a645f0ca 100644 --- a/framework/Log/lib/Horde/Log/Filter/Constraint.php +++ b/framework/Log/lib/Horde/Log/Filter/Constraint.php @@ -29,6 +29,8 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter_Interface * * @param string $field The field to apply the constraint to * @param Horde_Constraint $constraint The constraint to apply + * + * @return Horde_Log_Filter_Constraint A reference to $this to allow method chaining */ public function addConstraint($field, Horde_Constraint $constraint) { @@ -37,6 +39,7 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter_Interface } else { $this->_constraints[$field] = $constraint; } + return $this; } /** @@ -47,11 +50,12 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter_Interface * * @param string $field The name of the field that should be part of the event * @param string $regex The regular expression to filter by + * @return Horde_Log_Filter_Constraint A reference to $this to allow method chaining */ public function addRegex($field, $regex) { $constraint = new Horde_Constraint_PregMatch($regex); - $this->addConstraint($field, $constraint); + return $this->addConstraint($field, $constraint); } /** @@ -60,15 +64,18 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter_Interface * If the field does not exist on the event, then it is filtered. * * @param string $field The name of the field that should be part of the event + * @return Horde_Log_Filter_Constraint A reference to $this to allow method chaining */ public function addRequiredField($field) { $notNull = new Horde_Constraint_Not(new Horde_Constraint_Null()); - $this->addConstraint($field, $notNull); + return $this->addConstraint($field, $notNull); } /** * Adds all arguments passed as required fields + * + * @return Horde_Log_Filter_Constraint A reference to $this to allow method chaining */ public function addRequiredFields() { @@ -76,6 +83,7 @@ class Horde_Log_Filter_Constraint implements Horde_Log_Filter_Interface foreach ($fields as $f) { $this->addRequiredField($f); } + return $this; } /**