Skip to content

Commit

Permalink
Make use of method chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
fpoirotte committed Jul 29, 2017
1 parent 7ef2f79 commit 0e6ced6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/Cryptal/Implementers/AbstractHash.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ abstract class AbstractHash extends AbstractContextBasedAlgorithm implements Has
final public static function hash(HashEnum $algorithm, $data, $raw = false)
{
$obj = new static($algorithm);
$obj->update($data);
return $obj->finalize($raw);
return $obj->update($data)->finalize($raw);
}
}
3 changes: 1 addition & 2 deletions src/Cryptal/Implementers/AbstractMac.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ final public static function mac(
$raw = false
) {
$obj = new static($macAlgorithm, $innerAlgorithm, $key, $nonce);
$obj->update($data);
return $obj->finalize($raw);
return $obj->update($data)->finalize($raw);
}
}

0 comments on commit 0e6ced6

Please sign in to comment.