/** * constructor * * @api * @param array $propertyData the property data */ public function __construct(array $propertyData = []) { foreach ($propertyData as $section => $values) { foreach (array_keys($values) as $key) { if (substr($key, -8) === 'password') { $propertyData[$section][$key] = Secret::create($values[$key]); } } } $this->propertyData = $propertyData; }
/** * @test */ public function canSwitchBackingWhenAllSecretInstancesDestroyed() { $secret = Secret::create('payload'); $secret = null; expect(function () { assertTrue(Secret::switchBacking(Secret::BACKING_PLAINTEXT)); })->doesNotThrow(); }