Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/undo-ransomware/ransomware_detection.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Held <ilovemilk@wusa.io>2018-09-10 23:58:22 +0300
committerMatthias Held <ilovemilk@wusa.io>2018-09-10 23:58:22 +0300
commit7c2ba742257689eba6704240917c1979b5033d12 (patch)
treeb18eb940465a430e2e358738e52b79b552fe3749
parent8b949ae0784f06d73d8e4ff63c9454f54b8c2d82 (diff)
Use JsonSerializable
Signed-off-by: Matthias Held <matthias.held@uni-konstanz.de>
-rw-r--r--lib/Analyzer/EntropyFunnellingResult.php13
-rw-r--r--lib/Analyzer/SequenceResult.php13
-rw-r--r--lib/Controller/MonitoringController.php2
3 files changed, 7 insertions, 21 deletions
diff --git a/lib/Analyzer/EntropyFunnellingResult.php b/lib/Analyzer/EntropyFunnellingResult.php
index a3c7325..8b8c238 100644
--- a/lib/Analyzer/EntropyFunnellingResult.php
+++ b/lib/Analyzer/EntropyFunnellingResult.php
@@ -21,7 +21,7 @@
namespace OCA\RansomwareDetection\Analyzer;
-class EntropyFunnellingResult
+class EntropyFunnellingResult implements \JsonSerializable
{
/** @var float */
protected $medianWritten;
@@ -141,15 +141,8 @@ class EntropyFunnellingResult
$this->entropyFunnelling = $entropyFunnelling;
}
- public function toArray()
+ public function jsonSerialize()
{
- $var = get_object_vars($this);
- foreach ($var as &$value) {
- if (is_object($value) && method_exists($value, 'toArray')) {
- $value = $value->toArray();
- }
- }
-
- return $var;
+ return get_object_vars($this);
}
}
diff --git a/lib/Analyzer/SequenceResult.php b/lib/Analyzer/SequenceResult.php
index b5fce8b..6994b73 100644
--- a/lib/Analyzer/SequenceResult.php
+++ b/lib/Analyzer/SequenceResult.php
@@ -21,7 +21,7 @@
namespace OCA\RansomwareDetection\Analyzer;
-class SequenceResult
+class SequenceResult implements \JsonSerializable
{
/** @var int */
protected $sequenceId;
@@ -164,15 +164,8 @@ class SequenceResult
$this->sequence = $sequence;
}
- public function toArray()
+ public function jsonSerialize()
{
- $var = get_object_vars($this);
- foreach ($var as &$value) {
- if (is_object($value) && method_exists($value, 'toArray')) {
- $value = $value->toArray();
- }
- }
-
- return $var;
+ return get_object_vars($this);
}
}
diff --git a/lib/Controller/MonitoringController.php b/lib/Controller/MonitoringController.php
index 1abda78..b309361 100644
--- a/lib/Controller/MonitoringController.php
+++ b/lib/Controller/MonitoringController.php
@@ -166,7 +166,7 @@ class MonitoringController extends OCSController
foreach ($sequences as $sequenceId => $sequence) {
if (sizeof($sequence) >= $this->config->getAppValue(Application::APP_ID, 'minimum_sequence_length', 0)) {
- $result[] = $this->sequenceAnalyzer->analyze($sequenceId, $sequence)->toArray();
+ $result[] = $this->sequenceAnalyzer->analyze($sequenceId, $sequence);
}
}