Ejemplo n.º 1
0
 /**
  * Test that getMaskManager returns Magoo or compatible
  */
 public function testGetMaskManager()
 {
     // Arrange
     $magoo = new Magoo();
     $magoo->pushEmailMask()->pushCreditCardMask();
     $magooArray = new MagooArray($magoo);
     // Act
     // Assert
     $this->assertSame($magoo, $magooArray->getMaskManager());
 }
Ejemplo n.º 2
0
 /**
  * @param string $method
  * @param array $rawArguments
  *
  * @return array Masked arguments
  */
 private function getMaskedArguments($method, $rawArguments)
 {
     $arguments = $rawArguments;
     if (in_array($method, $this->logLevels)) {
         $maskedMessage = $this->maskManager->getMasked($arguments[0]);
         $arguments[0] = $maskedMessage;
         if (isset($arguments[1]) && !empty($arguments[1])) {
             $arguments[1] = $this->magooArray->getMasked($arguments[1]);
         }
         return $arguments;
     }
     $maskedMessage = $this->maskManager->getMasked($arguments[1]);
     $arguments[1] = $maskedMessage;
     if (isset($rawArguments[2]) && !empty($arguments[2])) {
         $arguments[2] = $this->magooArray->getMasked($arguments[2]);
     }
     return $arguments;
 }
Ejemplo n.º 3
0
<?php

/**
 * This file is part of Pachico/Magoo. (https://github.com/pachico/magoo)
 *
 * @link https://github.com/pachico/magoo for the canonical source repository
 * @copyright Copyright (c) 2015-2016 Mariano F.co Benítez Mulet. (https://github.com/pachico/)
 * @license https://raw.githubusercontent.com/pachico/magoo/master/LICENSE.md MIT
 */
require __DIR__ . '/../vendor/autoload.php';
use Pachico\Magoo\Magoo;
use Pachico\Magoo\MagooArray;
$magoo = new Magoo();
$magoo->pushByRegexMask('(foo)', 'bar');
$magooArray = new MagooArray($magoo);
$mySensitiveArray = ['It is time to go to the foo.', ['It is never too late to go the foo.'], new DateTime()];
$magooArray->getMasked($mySensitiveArray);
/*
Array
(
    [0] => It is time to go to the bar.
    [1] => Array
        (
            [0] => It is never too late to go the bar.
        )

    [2] => DateTime Object
        (
            [date] => 2016-08-21 11:44:33.000000
            [timezone_type] => 3
            [timezone] => UTC