Code Coverage  | 
     ||||||||||
Classes and Traits  | 
      Functions and Methods  | 
      Lines  | 
     ||||||||
| Total |         | 
      100.00%  | 
      1 / 1  | 
              | 
      100.00%  | 
      2 / 2  | 
      CRAP |         | 
      100.00%  | 
      9 / 9  | 
     
| EncoderFactory |         | 
      100.00%  | 
      1 / 1  | 
              | 
      100.00%  | 
      2 / 2  | 
      3 |         | 
      100.00%  | 
      9 / 9  | 
     
| build(LoggerInterface $logger) |         | 
      100.00%  | 
      1 / 1  | 
      2 |         | 
      100.00%  | 
      5 / 5  | 
     |||
| getStrategies() |         | 
      100.00%  | 
      1 / 1  | 
      1 |         | 
      100.00%  | 
      4 / 4  | 
     |||
| <?php | |
| /** | |
| * @author Krzysztof Gzocha <krzysztof.gzocha@xsolve.pl> | |
| */ | |
| namespace Team3\PayU\SignatureCalculator\Encoder; | |
| use Psr\Log\LoggerInterface; | |
| use Team3\PayU\SignatureCalculator\Encoder\Strategy\EncoderStrategyInterface; | |
| use Team3\PayU\SignatureCalculator\Encoder\Strategy\Md5Strategy; | |
| use Team3\PayU\SignatureCalculator\Encoder\Strategy\Sha1Strategy; | |
| use Team3\PayU\SignatureCalculator\Encoder\Strategy\Sha256Strategy; | |
| class EncoderFactory implements EncoderFactoryInterface | |
| { | |
| /** | |
| * @param LoggerInterface $logger | |
| * | |
| * @return EncoderInterface | |
| */ | |
| public function build(LoggerInterface $logger) | |
| { | |
| $encoder = new Encoder($logger); | |
| foreach ($this->getStrategies() as $strategy) { | |
| $encoder->addStrategy($strategy); | |
| } | |
| return $encoder; | |
| } | |
| /** | |
| * @return EncoderStrategyInterface | |
| */ | |
| public function getStrategies() | |
| { | |
| return [ | |
| new Md5Strategy(), | |
| new Sha1Strategy(), | |
| new Sha256Strategy() | |
| ]; | |
| } | |
| } |