Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added AbstractConfigurableAction class and tests, fixed #25 #26

Merged
merged 6 commits into from
Aug 9, 2016

Conversation

uuf6429
Copy link
Owner

@uuf6429 uuf6429 commented Jul 23, 2016

  • AbstractConfigurableAction
  • Unit test

/**
* {@inheritdoc}
*/
public function execute($eval, $context, $rule)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this method be final?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method is not supposed to be replaced by the child class, correct?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. Unfortunately, in PHP we don't have method overloading, otherwise this would have been better:

    final public function execute($eval, $context, $rule)
    {
        $configExpr = $this->getConfigExpression();
        $config = is_null($configExpr) ? [] : $eval->evaluate($configExpr);
        $this->execute($eval, $context, $rule, (array) $config);
    }

    abstract protected function execute($eval, $context, $rule, $config);

@uuf6429
Copy link
Owner Author

uuf6429 commented Jul 23, 2016

@mstovicek, @arvydasvapsva what do you think? This is very bare-bones class, but should still be a good start.

@codecov-io
Copy link

codecov-io commented Jul 26, 2016

Current coverage is 91.89% (diff: 100%)

Merging #26 into master will increase coverage by 0.51%

@@             master        #26   diff @@
==========================================
  Files            23         24     +1   
  Lines           429        444    +15   
  Methods          78         80     +2   
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            392        408    +16   
+ Misses           37         36     -1   
  Partials          0          0          

Sunburst

Powered by Codecov. Last update 3b471f6...68b5ba4

}
$result[] = sprintf(
'%s: (%s)',
var_export($name, true),
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that $name is scalar.

Copy link
Owner Author

@uuf6429 uuf6429 Aug 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mstovicek, this is not a problem. Apparently, one cannot use a complex type as key in a PHP array, so it's pointless to check the type because the value will already be supported.

@uuf6429 uuf6429 merged commit 0ff5537 into master Aug 9, 2016
@uuf6429 uuf6429 deleted the #25---ConfigurableAction-abstract-class branch August 9, 2016 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants