Skip to content

Commit

Permalink
Merge pull request #433 from Dyachenko/tiny-refactoring
Browse files Browse the repository at this point in the history
tiny refactoring
Glad to see you :)
  • Loading branch information
Anton committed Aug 2, 2017
2 parents ccfc278 + ea84fc9 commit d48d2ec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/Controller/Mapper/AbstractMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,8 @@ protected function dispatch()
$map = $this->map[$this->method];

// check permissions
if (isset($map['acl'])) {
if (!Acl::isAllowed($this->module, $map['acl'])) {
throw new ForbiddenException;
}
if (isset($map['acl']) && !Acl::isAllowed($this->module, $map['acl'])) {
throw new ForbiddenException;
}

// dispatch controller
Expand Down
5 changes: 3 additions & 2 deletions src/Validator/Rule/CreditCardRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ private function verifyMod10($input)
{
$sum = 0;
$input = strrev($input);
for ($i = 0; $i < strlen($input); $i++) {
$current = substr($input, $i, 1);
$inputLen = strlen($input);
for ($i = 0; $i < $inputLen; $i++) {
$current = $input[$i];
if ($i % 2 == 1) {
$current *= 2;
if ($current > 9) {
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/Rule/IpRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected function parseRangeUsingCidr($input, &$range)
throw new ComponentException('Invalid network mask');
}

$range['mask'] = sprintf('%032b', ip2long(long2ip(~(pow(2, (32 - $input[1])) - 1))));
$range['mask'] = sprintf('%032b', ip2long(long2ip(~(2 ** (32 - $input[1]) - 1))));
}

/**
Expand Down

0 comments on commit d48d2ec

Please sign in to comment.