Skip to content

Commit

Permalink
Removes SensitiveValue code
Browse files Browse the repository at this point in the history
I no longer believe this is a problem the framework should solve.
  • Loading branch information
jeremeamia committed Jul 9, 2021
1 parent d8a57e6 commit 79837c9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 45 deletions.
12 changes: 1 addition & 11 deletions src/Contexts/HasData.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@

use SlackPhp\Framework\Exception;

use const ARRAY_FILTER_USE_KEY;

trait HasData
{
/** @var array<string, mixed> */
protected array $data = [];

/** @var array<string, bool> */
protected array $sensitive = [];

/**
* This constructor can (and likely should be) be overridden by trait users.
*
Expand All @@ -33,11 +28,6 @@ private function setData(array $data): void
continue;
}

if ($value instanceof SensitiveValue) {
$this->sensitive[$key] = true;
$value = $value->getRawValue();
}

$this->data[$key] = $value;
}
}
Expand Down Expand Up @@ -149,7 +139,7 @@ private function getDeep(array $keys, array &$data)
*/
public function toArray(): array
{
return array_filter($this->data, fn (string $key) => !isset($this->sensitive[$key]), ARRAY_FILTER_USE_KEY);
return $this->data;
}

public function jsonSerialize()
Expand Down
34 changes: 0 additions & 34 deletions src/Contexts/SensitiveValue.php

This file was deleted.

0 comments on commit 79837c9

Please sign in to comment.